gevensen Posted February 15, 2010 Share Posted February 15, 2010 I have 3 separate tables where each has a common field called project I would like to create a query where the query shows entries from all 3 tables from the field project in each IOW table 1 has a project called project1 table 2 has a project called project2 and perhaps project1 is listed in there also table 3 has a project called project3 and perhaps project2 and project3 is listed in there also I would like my query to result in a list project1 project2 project3 drawing info from all 3 tables and not duplicating entries ( GROUP BY i assume ) can anyone help? a point in the right direction perhaps thanks Quote Link to comment https://forums.phpfreaks.com/topic/192137-point-in-the-right-direction/ Share on other sites More sharing options...
kickstart Posted February 15, 2010 Share Posted February 15, 2010 Hi Sounds like you just need 3 queries UNIONed together (use UNION to remove duplicates, not UNION ALL). All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/192137-point-in-the-right-direction/#findComment-1012613 Share on other sites More sharing options...
gevensen Posted February 15, 2010 Author Share Posted February 15, 2010 just figured it out thanks for the pointer it was (SELECT project FROM table1) UNION (SELECT project FROM sc_table2) UNION (SELECT project FROM sc_table3) ORDER BY project Quote Link to comment https://forums.phpfreaks.com/topic/192137-point-in-the-right-direction/#findComment-1012618 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.