MySql query query based on year or month

1. Query the corresponding data according to the year. For 

 example, 2011: select * from table where year (field name)='2011'; 

2. Find the data corresponding to the specified month: 

 such as December: select * from table where month (field name) ='12'; 

3. Find the data corresponding to the number of days (the second day of the year): 

 such as the second day of the year: select * from table where dayofyear (field name)='2';

Guess you like

Origin blog.csdn.net/Amos_liu/article/details/50781205