Skip to content
Advertisement

PostgreSQL left join query with one to many relationship

I have below tables

How to write select query from employee left join perks_details on perks id with id in perks_details table and aggregate functions so my result data looks like:

I tried multiple variations and couldn’t get near to a working query. Please advise/assist me here.

UPDATE I have this query with left join but the results are not what I expected

Advertisement

Answer

Hi you can do it in this way:

DEMO

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