My two tables are:
PkID | HouseFk | house_extra_id | Price | discount_id
1 | 5 | 6 | 1205 | 0
PkID | HouseFk | PacketFk | Price | discount_id
1 | 6 | 7 | 500 | 0
How can I combine those two into a new table which is not stored in a database but only used for output. I already tried join and union all but I can't get the desired table structure. I want the columns of the first and the second table, with NULL values where needed like so:
PkID | HouseFk | house_extra_id | Price | discount_id | PacketFk
1 | 5 | 6 | 1205 | 0 | NULL
1 | 6 | NULL | 500 | 0 | 7
If I use join on HouseFk I only get combined rows where HouseFk value is present in both tables and union all leaves out some of my columns!