This is my query.
select CONVERT(varchar, cast(date as datetime), 3)
from shoptransfer
group by year (date)
I want to group by the year part of the date (varchar) column, however I get the following error:
Column 'shoptransfer.Date' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
How do I group by the year part of the date column?