Followers

Monday, 30 March 2015

Combination of distinct, select join gorupby orderby isNULL

SELECT DISTINCT h.h1_id FROM table h LEFT JOIN table ph ON h.h1_id = ph.h1_id WHERE isNULL( ph.id ) group by h2_id order by count(h.h1_id) desc

No comments:

Post a Comment