数据库SQL Case...when...then...end的用法!

每次前端绑定数据的时候!如1:已支付 0:未支付 我们要把数字转换为对应的字符!   就可以用到  Case...when...then...end

    select   (case
           when o.PAYMENTMETHODID = 0 then  '货到付款'
           when o.PAYMENTMETHODID < 0 then  '在线支付'
           else
            ' '
          end)  paymentName  from  st_order  o

posted on 2016-01-05 10:22  只为_更加优秀!  阅读(467)  评论(0编辑  收藏  举报

导航