How do I do a where clause in sql and return a count back?
- by chobo2
Hi
I am using mssql and I want to make a query that returns a count back with a where clause.
Like say I have a product Table
ProductId
ProductName
Active
So how would I make it
I have like
Select Count(*)
From Product
now I don't know how to filter it so it only could if Active = true;
So if there are 3 active products then it would return a count of 3 even if there is a hundred rows in the db and the other 97 are only not active.
so the where clause would be probably like
where active = true
I am not sure how to put them together though.