Oh yah, typing too fast and then cutting and pasting will do that to ya.
Sorry. :)
- Original Message -
From: "Che Vilnonis" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, July 20, 2004 3:44 PM
Subject: RE: Quick SQL question...ma
= 4 THEN 1 ELSE 0 END) AS pos4Count
FROM MAE
WHERE ACTIVE = 1
-Original Message-
From: Deanna Schneider [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 20, 2004 4:36 PM
To: CF-Talk
Subject: Re: Quick SQL question...maybe.
SELECT SUM(CASE WHEN maepos = 1 THEN 1 ELSE 0) AS
select
(select count(meepos) from mae where maepos = 1) as pos1count,
(select count(maepos) from mae where maepos = 2) as pos2count
...
or better yet,
select maepos, count(maepos) as poscount
from mae group by maepos
order by maepos
This will return 2 columns and multiple rows - the first column
SELECT SUM(CASE WHEN maepos = 1 THEN 1 ELSE 0) AS pos1Count,
SUM(CASE WHEN maepos = 2 THEN 1 ELSE 0) AS pos2Count,
SUM(CASE WHEN maepos = 3 THEN 1 ELSE 0) AS pos3Count,
SUM(CASE WHEN maepos = 4 THEN 1 ELSE 0) AS pos1Count
FROM mae
- Original Message -
From: "Che Vilnonis" <
> Is there
4 matches
Mail list logo