[thelist] case statement catch-all? MSSQL
Brian Cummiskey
Brian at hondaswap.com
Wed Aug 24 09:37:35 CDT 2005
Jay Blanchard wrote:
> Perhaps a crosstab query; (bull-in-the-china-shop-method)
>
> SELECT
> SUM(IF(CT = 'C', 1, 0)) AS "CT",
> SUM(IF(PA = 'P', 1, 0)) AS "PA",
> SUM(IF(TX = 'T', 1, 0)) AS "TX",
> SUM((IF(CT = 'C', 1, 0)))+IF(PA = 'P', 1, 0))+IF(TX = 'T', 1, 0))) AS
> "ALL"
> FROM table
> GROUP BY whatever you see necessary
Thanks, but this fails miserably. syntax Errors on the IF's, and every
comma for the 1,0.
More information about the thelist
mailing list