来自前一列的Concat

时间:2015-06-10 22:36:14

标签: mysql

我有没有办法从逻辑确定的前一列中连接一列?

    
    select
    if(p.mfg is not null , p.mfg, 'Private') as MFG,
    concat(MFG, " ",p.sku) as TITLE
    from product p

1 个答案:

答案 0 :(得分:0)

您可以使用{/ 1}}语句,例如

CASE

(OR)使用select if(p.mfg is not null , p.mfg, 'Private') as MFG, concat(case when p.mfg is not null then p.mfg else 'Private' end, " ",p.sku) as TITLE from product p 之类的

inline view