convert date to year in sql code example
Example 1: sql convert datetime to year month
DATE_FORMAT(_column, '%Y-%m')AS `yyyy-mm`,
Example 2: sql convert datetime to year
select YEAR(getdate())
/* 2020 */
DATE_FORMAT(_column, '%Y-%m')AS `yyyy-mm`,
select YEAR(getdate())
/* 2020 */