There are two tables: user, proc_leader .
The first table consists of the names:
uid| username| salary| ---+---------+-------+ 1 | beny | 0 | 2 | barikan | 0 | The second proc_leader table consists of foreign key :
projectNo| process | proc_leader| ---------+---------+------------+ 1610004 | ANM BLD | beny | 1610004 | BGD CUP | barikan | 1610005 | ANM BLD | bob | 1610006 | BGD CUP | barikan | All data in this table are foreign key to other tables:
- projectNo foreign key in the project table
- process foreign key in the theme_name table
- proc_leader foreign key in the user table
I want to output using sql each name from the user table, each process and the project number to which it is assigned. For example, something like this:
uid| username| projectNo| process| ---+---------+----------+--------+ 1 | beny | 1610004 |ANM BLD | 1 | beny | 1610004 |BGD CUP | 2 | bob | 1610005 |ANM BLD | 2 |barikan | 1610006 |BGD CUP | How can this be done?