Skip to content
Advertisement

How can I join two results

I have 3 tables purchase, air_transfers and sea_transfers. I have made the example code in db fiddle. My problem is on 6th paragraph where I don’t have any sea transfers, I get null as id and thats because I’m using id from sea transfers. What should I do to fix this?

purchase table:

air transfer table:

sea transfers table:

my outer join:

if my sea transfers is empty I get this result:

enter image description here

Advertisement

Answer

I think you are looking for UNION ALL instead of FULL OUTER JOIN, because UNION ALL will combine two results air_transfers and sea_transfers tables, you will get all purchase_id and units values from two tables.

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