I have a table called 'userrating' with 3 INT fields in it as shown with sample data:
I want it to count each row of each field in seperate queries BUT ONLY if there is not a '0' in that row.
So the count of:
rating = 1
rating2 = 2
rating3 = 0
I have a start put i don't know how to check for zeros in the rows, here is what i have for the first field rating:
$ratinginfos = $db->query_read("SELECT *, COUNT(*) AS totalvotes, SUM(rating) AS total FROM " . TABLE_PREFIX . "userrating WHERE userid = $userinfo[userid] AND active=1 GROUP BY userid ORDER BY dateline DESC");