Kokoro Posted May 11, 2006 Share Posted May 11, 2006 Hi, I have this problem Suppose I have two tables with two columns each. I use a union to retrieve the info from both tables like this:SELECT Column1, Column2FROM Table1UNIONSELECT Column3, Column4FROM Table2Is there a way to sort the result by the first or second column without using the column number? Link to comment Share on other sites More sharing options...
Kokoro Posted May 11, 2006 Author Share Posted May 11, 2006 Well, to answer my own question,SELECT * FROM( SELECT Column1 as C1, Column2 as C2 FROM Table1 UNION SELECT Column3, Column4 FROM Table2) as ResultORDER BY Result.C1, Result.C2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now