如何为别名列提供与原始列不同的子句

时间:2016-05-18 04:11:06

标签: sqlite

这是我到目前为止所拥有的

SELECT Name, Composer, Composer AS MakeOver FROM Track 
WHERE Composer LIKE '%/%'
AND Composer NOT LIKE 'AC/DC'

我希望MakeOver列有

Like '$, %' 

或沿着这些行的某些东西,使一个作曲家列列表作曲家用正斜杠和一个用逗号。

1 个答案:

答案 0 :(得分:0)

    SELECT Name, 
    case when Composer LIKE '%/%' then Composer end as Composer, 
    case when Composer Like '$, %'  then Composer end AS MakeOver
    FROM Track
WHERE Composer LIKE '%/%'
AND Composer NOT LIKE 'AC/DC'