I have 2 tables query-hive-2022 and ppdb-2022 i want to find for the userdid in ppdb-2022 which did is not present in query-hive-2022 table.
I am using this query to achieve this
SELECT * FROM CBAX.`ppdb-2022` as t1 inner join CBAX.`query-hive-2022` as t2
on t1.userdid=t2.userdid
where t1.did is null ;
but it is not returning results.
CodePudding user response:
Ignoring pictures of data, this sounds like a job for exists
select *
from `ppdb-2022` p
where not exists (
select * from `query-hive-2022` q
where q.userdid = p.userdid
);