when a table contains a column called date, how can we find
out if it matches a specific year and get that data.(sql query)
Answers
Beatmaster
On 2006-08-20 00:02:23
SELECT *
FROM table_name
WHERE year(`date` ) =some_value
The reason why I've put date in accent quotes is that it may be a keyword in your SQL version and that could cause problems for you...I wouldn't recommend using date as a column name, though. I have tested this with MySQL and it works.
terry
On 2006-08-19 23:54:43
select * from Table where Year("date")='2006';
it depends on the DataBase you're using the year function may be differ
Answers
Beatmaster
On 2006-08-20 00:02:23
terry
On 2006-08-19 23:54:43
JJ
On 2006-08-19 23:13:51