现在有这样一个问题
需要查询 level + "Result" 这样一个数据,
level是本条记录中的一个字段,此处为值
如果本条记录的level为vip
那么就查询vipResult

解决方案 »

  1.   

    就像这样
    name         level      a_cash   b_cashzhangsan     a           10       10
    lisi         b           10       10
    现在要获取张三的a_cash
    李四的 b_cash
      

  2.   

    不知道MySql支持Case When不,LZ可以试试select case when level='a' then a_cash 
                     case when level='b' then b_cash end as cash from table