Jump to content

Query not returning results even though there is data?


jmrothermel

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.