Link to home
Start Free TrialLog in
Avatar of kinton
kinton

asked on

MS SQL 2008 Count Non 0 rows

Hi,

I have a table with a int field.  Without using a sub query I'd like to count the number of rows based on a condition, i.e. count the number of rows where a column is not 0.  i.e.
SELECT *, (COUNT(* WHERE COL A IS NOT 0)) FROM tablename.
ASKER CERTIFIED SOLUTION
Avatar of tim_cs
tim_cs
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Guy Hengel [angelIII / a3]
> Without using a sub query
you cannot do that at the same level as the query itself ...
Avatar of kinton
kinton

ASKER

Great, good answer!  Should have thought of that..