first: yes i'm a sql noob and i really need some help:
SELECT COUNT(id), SUM(rating), COUNT(rating) FROM comments WHERE phone='$phone';"
this needs to be something like this:
SELECT COUNT(id), SUM(rating), (COUNT(rating) WHERE rating>0) FROM comments WHERE phone='$phone';"
Can anyone help out?
WHEREclause to the actualWHEREclauses?SELECT COUNT(id), SUM(rating), COUNT(rating) FROM comments WHERE phone='$phone' AND rating > 0;??HAVING COUNT(rating) > 0...SELECT COUNT(id), SUM(rating), (COUNT(rating) HAVING rating>0) FROM comments WHERE phone='$phone';"But how is the correct sql-syntax? thanks