[AccessD] Count query

Gustav Brock gustav at cactus.dk
Wed Feb 25 10:12:46 CST 2004


Hi Oleg

Yes, adding the two sums should equal the total count ...

/gustav


> i need a count, not a sum :--)
> when i am trying count this way -- i just get a same number in both columns.
> I don't think Union Query would work here

> SELECT Count((Not IsNull(FileToSupervisor))) AS CheckedID,
> Count((IsNull(FileToSupervisor))) AS NotCheckedID
> FROM [Ron Data mid AP]
> WHERE (((Date()-[MS Date Opened])<149));



>> Hi Oleg
>>
>> How about this:
>>
>> SELECT
>>   Sum(ID * Abs(Not IsNull(FileToSupervisor))) AS CheckedID,
>>   Sum(ID * Abs(IsNull(FileToSupervisor))) AS NotCheckedID
>> FROM
>>   [Ron Data mid AP]
>> WHERE
>>   (Date() - [MS Date Opened] < 149);
>>
>> /gustav
>>
>>
>>> Is it possible for one query to count how many records are up to 150
>>> days old and have been chechked and the ones that haven't ? I
>>> understand how to do in 2 queris, i am wondering if its possible to do
>>> in one
>>
>>> thanks,
>>> Oleg
>>
>>> SELECT Count([Ron Data mid AP].ID) AS CountOfID
>>> FROM [Ron Data mid AP]
>>> WHERE (((Date()-[Ron Data mid AP].[MS Date Opened])<149))AND (([Ron
>>> Data mid AP].FileToSupervisor) Is not Null));
>>
>>> SELECT Count([Ron Data mid AP].ID) AS CountOfID
>>> FROM [Ron Data mid AP]
>>> WHERE (((Date()-[Ron Data mid AP].[MS Date Opened])<149))AND (([Ron
>>> Data mid AP].FileToSupervisor) Is Null));




More information about the AccessD mailing list