我希望能写下来:
IF PROV_ID = PROVIDER NOT ON FILE or blank then use BILLING_PROV
ELSE USE PROV_ID
Billing_prov
是列名,所以我想返回该值。
答案 0 :(得分:6)
SELECT
CASE WHEN (PROV_ID = [PROVIDER NOT ON FILE or blank])
THEN BILLING_PROV
ELSE PROV_ID
END
FROM
...
答案 1 :(得分:2)
我假设“不存档或空白”表示空
SELECT COALESCE(PROV_ID, BILLING_PROV) as Whatever
FROM ...