如果条件为true,则必须将列值填充为“y”,否则填充为“n”。但在hive中,它不支持case stetement中的子查询,这如何在hive中返回。
(case
when exists
(select 1
from fntable fs
join dfntable dfs
on fs.id = dfs.id
and dfs.datetime =
(select max (cd.datetime)
from dfntable cd group by id)
and fs.s_id = dfs.s_id) then 'Y'
else 'N')"
1条答案
按热度按时间evrscar21#
使用带有分析函数+左连接的子查询。当加入时,则为“y”: