mysql:
SELECT *
FROM (select * from songs order by artist asc) as songs2
WHERE artist LIKE 'a%' GROUP BY artist`
mssql:
SELECT *
FROM (select top 1000 * from songs order by artist asc) as songs2
WHERE artist LIKE 'a%' GROUP BY artist
This works in mysql but in mssql i get an error:
Column 'songs2.id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
++++++++++++++++++ now i select with this query : SELECT artist,album,song from (select top 1000 * from songs order by year asc, artist asc) as songs2 where artist like 'a%' group by artist,album,song; but it does not group by artist, i want only one artist per song available in the query