Reputation: 11
This SQL command:
SELECT pno,COUNT (DISTINCT sno) AS supplier_count
FROM spj
GROUP BY pno;
gives me below error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT sno) AS supplier_count FROM spj GROUP BY pno' at line 1
How to fix this error?
Upvotes: 0
Views: 106
Reputation: 1269793
Remove the space between the COUNT
and ()
:
SELECT pno, COUNT(DISTINCT sno) AS supplier_count
FROM spj
GROUP BY pno;
Upvotes: 2