I’ve got a big query where I SELECT SUM(column) which is grouped by another column… I also want to select the number of rows that equal a certain value. I don’t want to exclude those not matching from the sum function (so its not just a WHERE clause) I just want to COUNT if they are equal to a particular value (rather like COUNTIF in excel). Is there a built in SQL function for this? Otherwise I’ll have to do a separate query for each one and do mysql_num_rows, which would take extra time.

thanks swampboogie, works fine as I want to count when the value is one… but if I need any other number I just have to divide by that number at the end to get the real amount.
e.g. sum(case when column=3 then column/3 else 0 end) gives the number of rows which have the value 3