我有2个字段在一个表中。收据号码和金额。收据号码有3种类型,即银行,退款和折扣。红色输出的基础上,收据类型在单独的列。
4ioopgfo1#
使用CASE来执行此操作,如下所示:
SELECT Receipt, CASE LEFT(Receipt, 2) WHEN 'BR' THEN Amount END AS BANK, CASE LEFT(Receipt, 2) WHEN 'RD' THEN Amount END AS RFUND, CASE LEFT(Receipt, 2) WHEN 'MD' THEN Amount END AS DISCOUNT FROM ...
1条答案
按热度按时间4ioopgfo1#
使用CASE来执行此操作,如下所示: