使用qubole
我有
表a(json分析中的列…)
ID Recommendation Decision
1 GOOD GOOD
2 BAD BAD
2 GOOD BAD
3 GOOD BAD
4 BAD GOOD
4 GOOD BAD
我只需要选择建议好,但决策不好的ID。因此输出应该是3。
我试过:
SELECT a.ID
FROM (
select json_parsed['ID'] as ID
,json_parsed["Decision"] as Decision
,json_parsed["Recommendation"] as Recommendation
from A
where create_date >= '2020-11-18') a
Left JOin
(select json_parsed['ID'] as ID
,json_parsed["Decision"] as Decision
,json_parsed["Recommendation"] as Recommendation
from A
where create_date >= '2020-11-18') as b on a.ID = b.ID and b.Recommendation = "GOOD"
Where
b.Recommendation is NULL
1条答案
按热度按时间ifsvaxew1#
使用分析函数。
演示:
结果: