adspace
How to use order by with union operators in ms sql server?
Answer Posted / Idreesh Ahmed
To use the ORDER BY clause with the UNION operator in MS SQL Server, you can combine multiple SELECT statements with UNION and place the ORDER BY at the end of the query:n`(SELECT column1, column2 FROM table1 WHERE condition1) UNION (SELECT column1, column2 FROM table2 WHERE condition2) ORDER BY column1, column2`
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the different SQL Server Versions you have worked on?
What are the kinds of subquery?
Can we shrink data file in sql server?
What are the different types of subquery?
What are different types of constraints?
You have a stored procedure, which execute a lengthy batch job. This stored procedure is called from a trigger you do not want to slow the data entry process you do not want trigger to wait for this batch job to finish before it completes itself what you can do to speed up the process?
Equi join and non equi join is possible with sql server?
What is temporary table in sql server? Why we use temp table?
Disadvantages of the indexes?
What is a view in sql?
List the ways in which dynamic sql can be executed?
Can one drop a column from a table?
Is it possible to have clustered index on separate drive from original table location?
Explain system functions or built-in functions? What are different types of system functions?
What is clustered index