So I have 3 tables in total called companies\_company c, companies\_sharedtrainingunit cst and companies\_trainingunit ct. The first JOIN I created joined c and cst on the same company id.

```
SELECT c.id as consuming_company_id, c.name as consuming_company_name, cst.id as channel_connection_id, cst.training_unit_id as channel_id
FROM companies_sharedtrainingunit cst
FULL JOIN companies_company c ON c.id = cst.company_id
ORDER BY company_id ASC

```

which yields a table with results like

| consuming\_company\_id | consuming\_company\_name | channel\_connection\_id | channel\_id |
| --- | --- | --- | --- |
| 1 | company\_1 | 2000 | 100 |

Now I want this joined table created above joined to the same info from table c and a new table ct ie

```
SELECT c.id as owned_company_id, c.name as owned_company_name, ct.id as channel_id, ct.name as channel_name, ct.description as channel_description
FROM companies_trainingunit ct
FULL JOIN companies_company c ON c.id = ct.company_id
ORDER BY c.id

```

| owned\_company\_id | owned\_company\_name | channel\_id | channel\_name | channel\_description |
| --- | --- | --- | --- | --- |
| 2 | company\_2 | 100 | channel\_100 | description\_100 |

I have tried joining these two queries but no luck :(

I know they need to be joined on their channel ids

In the end I am looking for my table to looking something like:

| channel\_connection\_id | consuming\_company\_id | consuming\_company\_name | channel\_id | channel\_name | channel\_description | owned\_company\_id | owned\_company\_name |
| --- | --- | --- | --- | --- | --- | --- | --- |
| 2000 | 1 | company\_1 | 100 | channel\_100 | description\_100 | 2 | company\_2 |