SELECT DISTINCT
t1.Movie, t1.Genre, t1.Author, t1.[Watch Date]
FROM
(SELECT
m.[Name] AS Movie, mg.Genre, a.Author,
[Watch Date] = CONVERT(VARCHAR, wh.[Watch Date], 107)
FROM
Movie m, [Movie Genres] mg, Author a, [Watch History] wh
WHERE
Genre LIKE '%TV Shows%'
AND m.GenreID = mg.Id
AND m.AuthorID = a.Id
AND m.Id = wh.MovieId
ORDER BY
[Watch Date] DESC) t1 --LINE 64
GROUP BY
t1.Movie
I get this error:
Msg 1033, Level 15, State 1, Line 64
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.
I'm trying to select the first data of the table with distinct movie name. So I want to store every FIRST record of every movie