• The result set from a UNION is not guaranteed to be in any order, so, even if you could order the selects that are unioned, the order of the results would not be meaningful. That's why your statement produces an error. Perhaps something like this will work:

    
    
    SELECT a,b,c
    FROM (
    SELECT a, b, c, 1 s
    FROM d
    WHERE x = 1
    UNION
    SELECT a, b, c, 2
    FROM d
    WHERE x = 2) a
    ORDER BY c, s, b

    --Jonathan



    --Jonathan