Why can a window function not be used directly in a WHERE clause?
- A WHERE is evaluated before window functions, so the result must be filtered in an outer query
- B Window functions return multiple values
- C It is a syntax restriction with no reason
- D They can be used in WHERE
Answer
WHERE is evaluated before window functions, so the result must be filtered in an outer query
Wrapping the query in a subquery or CTE and filtering there is the standard pattern for getting the top row per group.





