SELECT u.id
FROM user u
WHERE u.id IN
((SELECT l.id FROM location l WHERE l.id = ?id ORDER BY l.idLocation DESC ))
What I want to do is make this Order By works. But It’s not possible to have a order by inside a view. How can I do this order by if not inside a view?
SQL Response:
Msg 1033, Level 15, State 1, Line 5 The ORDER BY clause is invalid in
views, inline functions, derived tables, subqueries, and common table
expressions, unless TOP or FOR XML is also specified.
You can’t. Only the outermost ORDER BY matters.
So
SELECT * FROM MyView ORDER By Whateveris the only way.Any intermediate ordering (whether ORDER BY or coincidental, or part of the lan) is ignored