mameha Posted October 15, 2007 Share Posted October 15, 2007 I have some user records stored in two tables. The table structure is identical. table1 = latest data table2 = archived data (once a month the latest data is added to the archived data). Question: How to select data from BOTH tables at once? I tried this but it failed: SELECT `lastname` , `firstname` , `email` FROM `table1` , `table2` WHERE `country` = 'CN' Quote Link to comment Share on other sites More sharing options...
Barand Posted October 15, 2007 Share Posted October 15, 2007 Use a UNION, not a JOIN SELECT `lastname` , `firstname` , `email` FROM `table1` WHERE `country` = 'CN' UNION SELECT `lastname` , `firstname` , `email` FROM `table2` WHERE `country` = 'CN' 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.