Skip to content
Advertisement

Compare SQL Count

I want to return the name, which has not the con_id nr 2 and has more objects (count(*)) than in con_id nr 2.

My statement isnt working because of the count.. can someone help me pls

the return statement without the compare looks like this

Advertisement

Answer

WHERE clause is applied before GROUP BY. What you’re looking for is HAVING

Also you don’t have any join condition with c2, and those expressions: c.count(*), c2.count(*) are not syntactically correct.

Anyway I think you need a simple query like this

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement