select 
(case XX when 'AA' then 1 else 0 end) as AA,
(case XX when 'BB' then 1 else 0 end) as BB,
(case XX when 'CC' then 1 else 0 end) as CC
from 表

解决方案 »

  1.   

    回复人: lw1a2(一刀 [email protected]) ( ) 信誉:100  2005-12-08 09:13:00  得分: 0  
     
     
       select 
    (case XX when 'AA' then 1 else 0 end) as AA,
    (case XX when 'BB' then 1 else 0 end) as BB,
    (case XX when 'CC' then 1 else 0 end) as CC
    from 表
      
     
      

  2.   

    2,3楼正确 SQL Server-----------------------------------------------------
      

  3.   

    回复人: ljz9425(阿九) ( ) 信誉:100  2005-12-08 10:21:00  得分: 0  回复人: lw1a2(一刀 [email protected]) ( ) 信誉:100  2005-12-08 09:13:00  得分: 0  
     
     
       select 
    (case XX when 'AA' then 1 else 0 end) as AA,
    (case XX when 'BB' then 1 else 0 end) as BB,
    (case XX when 'CC' then 1 else 0 end) as CC
    from 表