I have a form with a text field, where the user will provide the year only and MySQL data should return all the data for the given year. But in MySQL database, the date is given in date(yyyy-mm-dd) format.
Can anyone suggest the SQL query which will fetch all the data for that particular year?
try this one, use the MySQL
YEARfunction.so in the given example, the server will select all records where year is equal to 2012.
UPDATE 1
SQLFiddle Demo
YEAR