结果:“类型”附近:语法错误 第 2 行:
选择 发票日期, 帐单地址, 比林城, 全部的, 案件 当总计 < 2.00 THEN 'Baseline Purchase' ELSE 'Top Performer' END AS Purchase Type FROM Invoice WHERE Purchase Type = 'Top Performer' ORDER BY BillingCity
列名称或别名中不能有空格,就像
Purchase Type
中那样。您可以使用双引号 ("
) 转义此名称:
SELECT InvoiceDate, BillingAddress, BillingCity, total,
CASE WHEN total < 2.00 THEN 'Baseline Purchase'
ELSE 'Top Performer'
END AS "Purchase Type"
-- Here^-------------^
FROM Invoice
WHERE Purchase Type = 'Top Performer'
ORDER BY BillingCity