Hi Friend
I am facing a problem i have different records with same date but with different times. The feilds having datatype datetime. Now i want to delete all the records with same date only..
but when i am running this query:
DELETE FROM auct_lots_full WHERE lot_date='2009-07-31';
so this query doesn't gave me any positve result..
Please Help me regarding this query
Thanks And Regards
Delete query with respect to date only
Moderator: General Moderators
-
habib009pk
- Forum Commoner
- Posts: 43
- Joined: Sun Jul 05, 2009 11:28 pm
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Delete query with respect to date only
You will need to convert the datetime value to a date value, I.e.,
Otherwise, treat the date as a range, I.e.,
Code: Select all
... WHERE DATE(lot_date) = '2009-07-31'Code: Select all
... WHERE lot_date BETWEEN '2009-07-31 00:00:00' AND '2009-07-31 23:59:59'