joining two tables

sql

Solution

One way to do it would be

SELECT  u.*, 'Developer'
FROM    users u
        INNER JOIN developer d ON d.user_id = u.user_id
UNION ALL 
SELECT  u.*, 'Manager'
FROM    users u
        INNER JOIN manager m ON m.user_id = u.user_id

Problem

I have users table. There are three other tables: developers, managers, testers. All of these tables have a foreign key user_id. I need to find all the users who are either developer or manager. What the sql will look like? Update: Someone can be both a developer and a manager.

Original source