Forums

This topic is locked

SQL Question

Posted 17 Apr 2002 19:35:43
1
has voted
17 Apr 2002 19:35:43 Matt Homey posted:
Here's my sql statement:

"SELECT COUNT(id) as total, AVG(survey1) as survey1avg, AVG(survey2) as survey2avg, AVG(survey3) as survey3avg, AVG(survey4) as survey4avg, AVG(survey5) as survey5avg FROM surveytable"

The above variables must not include any value under 1 from the field. For instance, the statement "AVG(survey1) as survey1avg" would need to be written as "AVG(survey1 WHERE survey > 0) as survey1avg". The syntax is wrong though. The average of the values in the column survey1 must not include zeroes.

What FROM statement would I use to achieve this?

Any help is greatly appreciated. Thank you.



Sincerely,

Matt

Rerun generation - www.betaparticle.com/home

Reply to this topic