Multiple count results in Query with different WHERE conditions.
Posted on 2007-08-09
The language is c# but this question is query specific though..
Ok.. i'm creating a query which will return some statistics, and what's special in this case.. is that one count must include all the records, while another one.. will only count for a specific set of records.. i'll describe with kvasi-sql here :
PS ! the --> (where xxxxx = "xxx") <-- is explaining the where situation i need pr count.
select count(numberofcontracts) AS amountCon,
count(status) AS acceptedCon--> (where status = "accepted") <--,
count(status) AS notAccepted --> (where status = "notaccepted") <--,
count (progress) --> (where progress = "development") <--
from table where costumernumber = 'something'.
Hope i explained me well enough :)