ashburnham Posted February 26, 2008 Share Posted February 26, 2008 I have two tables in my database as follows: `table1` refstartend 278XYZ123 279XYZ348 282XYZ982 `table2` refstartend 280ABC439 281ABC398 As you can see they have exactly the same headers. I would like to run an SQL query that integrates these two tables and orders it by the `ref` column so we have a result as follows: refstartend 278XYZ123 279XYZ348 280ABC439 281ABC398 282XYZ982 Any help on this would be much appreciated, thanks... P.S. The `ref` column is unique between the two tables so there would never be duplicate ref. Quote Link to comment Share on other sites More sharing options...
freenity Posted February 26, 2008 Share Posted February 26, 2008 (select * from table1) union (select * from table2) order by `ref` Quote Link to comment Share on other sites More sharing options...
ashburnham Posted February 26, 2008 Author Share Posted February 26, 2008 done the trick - thanks Quote Link to comment Share on other sites More sharing options...
aschk Posted February 26, 2008 Share Posted February 26, 2008 Curiously why do you have this table setup? Normalise it and get that data into the same table Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.