Edit:
After you're edit, see this from the documentation:
You attempted to execute a SELECT statement which contained a GROUP BY function such as MIN, MAX, SUM or COUNT. You attempted to execute an expression within the SELECT list which is not in the GROUP BY clause.
Put Group By
before Having
, and also include all fields (not the max) in the Group By Clause
SELECT id, max(id), artist as "Artist"
From d_songs
Where duration in('3 min', '6 min', '10 min')
where id < 50
Group by id, artist
You can view the docs for more information