Fetching Records with Date Comparision
Hi friends,
I have a table 'Medicine'
id name expirydate
1A 04-06-2011 17:00:00
2B 04-06-2011 23:57:57
3C 04-06-2011 01:00:00
4D 04-05-2011 10:00:00
5E 04-07-2011 09:00:01
I want to find all medicine which expire on or before 04-06-2011.
select * from medicine where expirydate < getdate();
I fire this query on 04-06-2011 at 17:30:00
and got result
id name expirydate
1A 04-06-2011 17:00:00
3C 04-06-201101:00:00
4D 04-05-201110:00:00
it not contain record ID 2.
how can I find actual result which also contain record 2?
I can not use as 'expiryDate < getdate()+1'.
Thanks.