This is a discussion on date delete query within the MySQL forums, part of the Database Server Software category; --> Hello, I have a table called DateOfBirth which has dates in the format: '2001-08-23 00:00:00'. I want to make ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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' |
| ||||
| On Mar 20, 4:57 am, "Captain Paralytic" <paul_laut...@yahoo.com> wrote: > 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' Thanks a lot Captain. It worked. The column is a date column. Thanks again mate. Roohbir |