我有这两个表:
table products
(
product_id bigint,
product_name string
)
partitioned by (product_category as string)
table place_of_sale
(
product_id bigint,
city string
)
partitioned by (country as string)
我如何基于'product_id'离开2个表,但是将它们放在table_of_sale表的'country'分区上?
我有这两个表:表产品(product_id bigint,product_name字符串)按(product_category作为字符串)分区了表place_of_sale(product_id bigint,city字符串)按(...)分区了...
select s.country, p.product_id, p.product_name, p.category,
case when s.product_id is NULL then "not sold" else "sold" as sold
from products p
left join place_of_sale s on p.product_id = s.product_id
order by country, product_id --order if necessary