Quantcast
Channel: Teradata Forums - Hadoop
Viewing all articles
Browse latest Browse all 62

Need to get common users for every combination of user IDs - response (1) by dnoeth

$
0
0
SELECT t1.UserId, t2.UserId, COUNT(*)
FROM tab AS t1 
JOIN tab AS t2
  ON t1.UserId < t2.UserId   -- different user id 
 AND t1.UserId1 = t2.UserId1 -- same user id 1
GROUP BY 1,2 

 


Viewing all articles
Browse latest Browse all 62

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>