Search

Duplicate Emails

SELECT a.email FROM ( SELECT email, COUNT(*) AS count_num FROM Person GROUP BY email ) AS a ## ํ•„์ˆ˜ WHERE a.count_num >= 2 ;
SQL
๋ณต์‚ฌ
๋ชจ๋“  ์„œ๋ธŒ์ฟผ๋ฆฌ ํ…Œ์ด๋ธ”๋“ค์€ Alias๊ฐ€ ๋ถ™์–ด์•ผ ํ•œ๋‹ค
group by๋กœ ์—ฐ์‚ฐ๋œ ์นผ๋Ÿผ์„ ๊ณ„์‚ฐ โ†’ having
SELECT email, count(id) as cnt FROM Person GROUP BY Email HAVING COUNT(id) >= 2 ;
SQL
๋ณต์‚ฌ