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 pa
You should add column shoptransfer.Date into group by clause.
shoptransfer.Date
select CONVERT(varchar,cast(date as datetime),3) from shoptransfer where SUBSTRING(productcode, 5, 3) like '%' group by CONVERT(varchar,cast(date as datetime),3)