Skip navigation links

MySQL Forums :: MySQL Query Browser :: Compare Date


Advanced Search

Compare Date
Posted by: Tay Geok Lin ()
Date: June 02, 2009 11:09PM

Hi all

I want to ask how can i compare current date and the date i store in the database for my food?

eg. if i have a rice which expire in 4 days and a spaghetti that is going to expire in 2 days. I want it to display the one that expire in 2 days.

this is my query.
SELECT b.title FROM books b, avaliable a, ingredient i
where datediff(STR_TO_DATE(b.expiry, '%d-%b -%Y') , now()) Between 0 and 6
and b.book_id = a.book_id and a.Int_ID = i.Int_ID

Options: ReplyQuote


Subject Written By Posted
Compare Date Tay Geok Lin 06/02/2009 11:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.