Re: date delete query On 20 Mar, 10:49, "roohbir" <ros...@gmail.com> wrote:
> Hello,
> I have a table called DateOfBirth which has dates in the format:
> '2001-08-23 00:00:00'.
> I want to make a query which deletes the dates after the year 1996.
> Would be really thankful if someone helps me with this query.
> Thanks
> Ros
Do you mean "deletes records where the column 'colname' has dates
after the year 1996"?#
If so, assuming that the column is a date column then
DELETE FROM `DateOfBirth` WHERE YEAR(`colname`) > 1996
If it is a text column then
DELETE FROM `DateOfBirth` WHERE LEFT(`colname`, 4) > '1996' |