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...maybe.

> Thanks Deanna...I got an error initially, but I remembered to add the END
> statement.
>
> SELECT SUM (CASE WHEN maepos = 1 THEN 1 ELSE 0 END) AS pos1Count,
>   SUM (CASE WHEN maepos = 2 THEN 1 ELSE 0 END) AS pos2Count,
>   SUM (CASE WHEN maepos = 3 THEN 1 ELSE 0 END) AS pos3Count,
>   SUM (CASE WHEN maepos = 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 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 an easy/simple way to combine these four queries into one?
>   > I'm not thinking clearly today. :(
>   >
>   > SELECT COUNT (MAEPOS) AS Pos1Count
>   > FROM MAE
>   > WHERE MAEPOS = 1
>   >
>   > SELECT COUNT (MAEPOS) AS Pos2Count
>   > FROM MAE
>   > WHERE MAEPOS = 2
>   >
>   > SELECT COUNT (MAEPOS) AS Pos3Count
>   > FROM MAE
>   > WHERE MAEPOS = 3
>   >
>   > SELECT COUNT (MAEPOS) AS Pos4Count
>   > FROM MAE
>   > WHERE MAEPOS = 4
>   >
>   > Thanks Che
>   >
>   >
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to