[thelist] SQL Union and order by problem

Joel D Canfield joel at streamliine.com
Thu Oct 18 13:21:39 CDT 2007

> i want to make query from union of 2 subqueries.
> subquery 1 : simple query with order by b desc
> subquery 2 : simple query with order by b asc

>From SQL BOL: "When UNION is used, the individual SELECT statements
cannot have their own ORDER BY or COMPUTE clauses. There can be only one
ORDER BY or COMPUTE clause after the last SELECT statement; it is
applied to the final, combined result set."

Perhaps if you explain why you want the same data sorted two different
ways in the same result set, we could offer alternatives.


More information about the thelist mailing list