Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can someone please help I keep on getting this error: 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. This is the query I'm using:


What I have tried:

UPDATE  SMS 
SET idx30 = 'New' 
WHERE idx30 in (SELECT * 
    FROM SMS 
    WHERE
    idx30 IS NULL
    AND 
    (idx15 = 'Del' OR idx15 = 'Fail')
    AND 
    Idx13 <> '1'
    AND
    Idx7 >= DATEADD(day, -1, GETDATE()) 
    ORDER BY idx7 DESC);
Posted
Updated 14-Sep-17 22:04pm

The error message is pretty clear:
Quote:
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.
Try removing it, or add TOP or OFFSET to make it worthwhile - without them, it serves no useful function.
 
Share this answer
 
Hello,
Refer : this answer
Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900