sql删除交集数据

因为是hive的事务表,没有主键。需要删除一个table1中与table2有交集的数据。

DELETE FROM ods_logs_to_hive_orc.clw_user_srv 

WHERE (create_time,user_id) IN

(
SELECT t2.create_time,t2.user_id

FROM ods_logs_to_hive_orc.clw_user_srv_day t1

INNER JOIN ods_logs_to_hive_orc.clw_user_srv t2

ON t1.create_time=t2.create_time AND trim(t1.user_id)=trim(t2.user_id)
)

 

posted @ 2020-05-13 16:45  singsong~  阅读(714)  评论(0编辑  收藏  举报