ORDER BY before SELECT?

sql, sql-server

Solution

ORDER BY is evaluated before the SELECT, as the ordering changes the results returned.

`TOP 1` also ensures the lowest `REVISION_NO` is returned, therefore it appears you are using the query correctly.

Problem

I'm just trying to add in an the newest estimated return date for a car as part of a subquery in my Select statement, I just wanted to know if this was how it is done? I think I heard that Select happens before Order By so wanted to do a quick check. ``` select top 1 ESTIMATE_RETURN_DATE from CHECK.AOS where AOS.AUTO_NO = CHECK_EVENT.AUTONUM_4 ORDER BY REVISION_NO desc ```

Original source