我正在使用以下查询:
select UserId, Category from customer_data
where (Category in ('Fashion','Electronics'))
and (Action in ('Click','AddToCart','Purchase'))
and customer_data.UserId not in (select ustomer_data.UserId from customer_data where customer_data.Category='Fashion' and customer_data.Category='Electronics') ;
获取以下错误:
hive> Unsupported SubQuery Expression ''Fashion'': SubQuery expression refers to Outer query expressions only.
我不确定这个错误,我是否需要在外部查询中为每个cloumn(如customer\u data.category)使用表名?你能帮忙吗?
样本数据:
UserId,ProductId,Category,Action
1,111,Electronics,Browse
2,112,Fashion,Click
3,113,Kids,AddtoCart
4,114,Food,Purchase
5,115,Books,Logout
6,114,Food,Click
7,113,Kids,AddtoCart
8,115,Books,Purchase
9,111,Electronics,Click
10,112,Fashion,Purchase
3,112,Fashion,Click
12,113,Kids,AddtoCart
期望输出:
Output File
• userID
• category
1条答案
按热度按时间ljsrvy3e1#
使用分析函数计算每个用户标识的标志: