Count() in a query - conditional???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi Guys,

Can a count() return a value depending on the condition of the checkbox
field it is summing? I am counting the number of records per name with a
checkbox field is true using a where clause. But I also want to count another
checkbox depending on the first. Is that possible in one query? here's what
i am thinking:

SELECT [FA Name],
Count([BSA FA]),
Count([Business Case] Where [Business Case]=true)
FROM [WM Cases]
WHERE ([BSA FA]=true)
GROUP BY [FA Name];

I want tot he count the # of true business cases from the results of the
true BSA FA.
 
I tried this Sum(IIf([TYPE]="FIX",1,0))
I make my field that I Need (FIXED) it then puts the value of 1 which I
want, but it excludes all the records with the field [TYPE] values "UNFIX"
and "NEEDFIX"
DAMN DAMN DAMN!!
Sorry losing sleep. Thanks ahead!

Douglas J. Steele said:
Try using Abs(Sum([Business Case])) or Sum(IIf([Business Case], 1, 0))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



MaBell said:
hi Guys,

Can a count() return a value depending on the condition of the checkbox
field it is summing? I am counting the number of records per name with a
checkbox field is true using a where clause. But I also want to count
another
checkbox depending on the first. Is that possible in one query? here's
what
i am thinking:

SELECT [FA Name],
Count([BSA FA]),
Count([Business Case] Where [Business Case]=true)
FROM [WM Cases]
WHERE ([BSA FA]=true)
GROUP BY [FA Name];

I want tot he count the # of true business cases from the results of the
true BSA FA.


--

Thanks in advance,
Matt
(access 2000)
 
Back
Top