SELECT num, COUNT(num) AS amt
FROM table
WHERE num IN (
SELECT num
FROM table
WHERE id IN (1,2,3))
GROUP BY num
HAVING amt > 1
Also, how can I get
‘777’ => ‘2’
.. instead of
‘num’ => ‘777’
‘amt’ => ‘2’
as result?
thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You cannot do a
whereon a aggregate column, you have to usehavingfor those.