stig1 Posted November 18, 2010 Share Posted November 18, 2010 I want to have two select statements extracting the same data from the table, however the where case is different on each select statement, also want to sort the whole results from both queries as one, in ascending order. Can this be done? If so, how? Cause currently i run two separate queries, and it looks ugly when showing a list of data in wrong order. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/219043-multiple-select/ Share on other sites More sharing options...
vichu.1985 Posted November 18, 2010 Share Posted November 18, 2010 Dude, U might need to use union for this: Consider the following query select * from( select * from table_name where field1=value1 union select * from table_name where field2=value2) tab order by field3 Hope this will help you Quote Link to comment https://forums.phpfreaks.com/topic/219043-multiple-select/#findComment-1135958 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.