SQL SERVER – UNION ALL and ORDER BY – How to Order Table Separately While Using UNION ALL
I often see developers trying following syntax while using ORDER BY. SELECT Columns FROM TABLE1 ORDER BYÂ Columns UNION ALL SELECT Columns FROM TABLE2 ORDER BYÂ Columns However the above query will return following error. Msg 156, Level 15, State 1, Line 5 Incorrect syntax near the keyword ‘ORDER’. It is not…
Read More
