Skip to content
Advertisement

postgresql inner join and left join

I have the following database structure, with postgres 9.5:

I have three users in my table. user1@example.com, user2@example.com are two normal users. manager@example.com is their manager. Now I want to display the following structure:

I tried with the following sql query but it fails to work for me with syntax error near JOIN. Any help ?

Advertisement

Answer

Remove space, rename u2.email, drop the cast to text:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement