select a from 表 where b>=a
union
select b from 表 where b<a

解决方案 »

  1.   

    select c=case 
             when b>=a then a
             else b
             end
    from tablename
      

  2.   

    我说错了 应是在一个表里面
    ID    a      b 
    1     10    50
    2     20    40
    3     30    30
    4     40    20 
    5     50    10结果
    ID    a      b    c
    1     10    50    10
    2     20    40    20 
    3     30    30    30
    4     40    20    20 
    5     50    10    10
      

  3.   

    select *,case when a>=b then a else b end as c
    from youtablename
      

  4.   

    select *,(case when a>=b then a else b end) as c
    from 表
      

  5.   

    select *,c=case 
             when b>=a then a
             else b
             end
    from tablename
    --where 
    --order by 
      

  6.   

    那就是你在表中增加一个字段 c
    然后修改其的值
    update table set c=case when b>=a then a else b end