[thelist] case statement catch-all? MSSQL
Brian Cummiskey
Brian at hondaswap.com
Wed Aug 24 08:23:03 CDT 2005
Matt Warden wrote:
>>select
>> case site when 'C' then 'CT' when 'P' then 'PA' when 'T' then 'TX'
>>else null end as 'Site'
>>from
>> table
>>group by
>> site
>>
>>
>>works fine and dandy.
>>
>>However, There is a 4th column- "Overall" which includes all 3 sites.
>>I'm not sure how to add that into my case statement.
>
>
> OR's should work. Could you give us an idea of what the site "field"
> looks like when you want it to say "Overall"? Or did I get that backwards?
There are 3 sites listed in the table; char(1)- C,P, and T for the
above states. There are no nulls (if there are, thats another issue :p )
I need the following results:
CT | PA | TX | ALL 3 SITES COMBINED/OVERALL
---------------------------------------------
% % % %
the percent and all that good stuff I can take care of... i'm just not
sure how to grab each seperately by the site field, and then basically
disregard the site field and take everything
More information about the thelist
mailing list