Hello dear group, can you help me with this error.
Example:
SELECT
CAMPO01,
CAMPO02,
CAMPO03
FROM TABLA01 ORDER BY CAMPO02 DESC
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.
Hi @Gfranco2021
Can you please show us your configuration and errors so we can understand better what is happening. Is it ORACLE, SQL SERVER, POSTGRES ?
You can absolutely use an ORDER BY clause in a SQL statement. Please give us some more information so we can help you.
My problem is that I had a client with 4 records, but I only wanted to filter the last record. I thought I could achieve it with ORDER BY DESC, however, I achieved my goal with a MAX and a GROUP BY.
@Gfranco2021 you could see if your database world support Window functions like RANK that could give you more control which entry you would like to see returned