Jump to content

Recommended Posts

I am doing this directly in MySQL - so its not a PHP coding issue or anything.  I have a field that is date  date  No  0000-00-00  format.  I am trying to do this query on it:

 

< DATE_SUB(CURDATE(), INTERVAL 4 DAY

 

Its returning no results - even though I know there is a line in there with the date 2008-01-29.

 

Any suggestions why its not returning the result?

That is my whole query.  When I go into the database Im going up to search at the top and in the field next to the date I select the "<" carat and type in the search box DATE_SUB(CURDATE(), INTERVAL 4 DAY I then click Go for the results.

SELECT * 
FROM `pets` 
WHERE `lastfed` < 'DATE_SUB(CURDATE(), INTERVAL 4 DAY'
LIMIT 0 , 30 

 

And dates is backwards for whatever reason.  If I turn the carat around I get all the results WITHIN the last four days.  (2-26 to 3-2) I want all results from before that.  So thats definately the carat I want.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.