|
thanks for your reply wes, but it doesnt
look like that is going to work with interbase (firbird 1.0)
firstly interbase didnt like the [ so i
replaced with (
now it doesnt like the select after the
from statement, which was going to be the solution to my Q
=(
----- Original Message -----
From: Wes
Edwards
Sent: Monday, March 24, 2003 1:02 PM
Subject: RE: [DUG]: multi aggregates with clauses?? I spent 5
minutes looking at this and I don't think it is quite right. If you want
proportions (ie SumofCountL/TotalCount) returned in your result set you might be
out of luck on some platforms and may have to resort to calculating the
proportions in a reporting field or in a stored proc. Performance may also
be dismal with this approach. Hopefully this might head you in the right
direction though ...
SELECT extract(month from incident.incident_date) AS TheDate,
Count(incident.incident_date)
AS TotalCount,
Sum(L.CountL) AS SumOfCountL,
Sum(M.CountM) AS SumOfCountM,
Sum(N.CountN) AS SumOfCountN,
Sum(NLL.CountNull) AS SumOfCountNull
FROM incident,
[select incident.ltiormti, Count( incident.ltiormti) as CountL from incident
where incident.ltiormti = 'L']. AS L,
[select incident.ltiormti, Count( incident.ltiormti) as CountM from incident
where incident.ltiormti = 'M']. AS M,
[select incident.ltiormti, Count( incident.ltiormti) as CountN from incident
where incident.ltiormti = 'N']. AS N,
[select incident.ltiormti, Count( incident.ltiormti) as CountNull from incident
where incident.ltiormti is null]. AS NLL
WHERE companyid = companyid and ((extract(month from incident_date) >= 3 and extract(year from incident_date) >= 2002) or (extract(month from incident_date) < 3 and (extract (year from incident_date) = 2003))) GROUP BY incident.incident_date
ORDER BY incident.incident_date; Cheers
Wes
Edwards
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tracey Maule Sent: Monday, 24 March 2003 11:56 a.m. To: Multiple recipients of list delphi Subject: [DUG]: multi aggregates with clauses??
--- |
Title: Message
- [DUG]: multi aggregates with clauses?? Tracey Maule
- RE: [DUG]: multi aggregates with clauses?? Wes Edwards
- Re: [DUG]: multi aggregates with clauses?? Tracey Maule
- Re: [DUG]: multi aggregates with clauses?? Neven MacEwan
- Re: [DUG]: multi aggregates with clauses?? Tracey Maule
- Re: Re: [DUG]: multi aggregates with clauses... Chris Reynolds
- Re: Re: [DUG]: multi aggregates with clau... Tracey Maule
- Re: Re: [DUG]: multi aggregates with... Neven MacEwan
- Re: Re: [DUG]: multi aggregates with... Steve Peacocke
- Re: [DUG]: multi aggregates with clauses?? Chris Reynolds
