Hi I am working in postgres. I have below table contract_para
contract_para
Id
1
2
3
4
5
contract_lines
Id | para_id
1 | 1
2 | 2
3 | 3
Output
contract_para_id | contract_lines_id | contract_lines_para_id
1 | 1 | 1
2 | 2 | 2
3 | 3 | 3
4 | null | null
5 | null | null
I would like to join two tables and return matching data and also return data appears in first table and not in second. Can someone please help me with the query. Thanks
2
Answers
This will retrieves rows from contract_para (
from contract_para
) even if there are no matching rows in contract_lines (left join contract_lines
) :Left outer join will work here :
Refer :