What I would like to know is, if you could take two queries and get them orderly represented in one resultset.
So in example we take two queries:
Select a.col1, a.col2 from a where a.col3 = 1 Order By a.col2
and
Select a.col1, a.col2 from a where a.col4 = 0 Order By a col2
I know its very easy to combine both queries into one in this case:
Select a.col1, a.col2
from a
where a.col3 = 1 and a.col4 = 0 Order By a col2
But the order of the result rows will now be mixed between first and second query.
Whereas I'm looking for an order where I get first all the first query results and second all the second query results
Also I see you could easily solve this example by ordering by col3 and col4. But I hope you see this is no solution to many other conditions given.
Maybe there is no general way, but I don't know all the functions one could use and I'm not really advanced in writing up query commands
Thank you.