答案 0 :(得分:1)
使用cross join
生成行,然后使用left join
:
select c.country, t2.product_id, t1.cost
from (select distinct country from table1) c cross join
table2 t2 left join
table1 t1
on t1.country = c.country and t1.product_id = t2.product_id
order by c.country, t2.product_id;
答案 1 :(得分:1)
尝试此操作以获取所需的输出:
mid