我尝试执行查询并在运行中创建一个新列,其值取决于使用case语句的其他列。请注意,RATE是表中不存在的新列。你能告诉我我哪里错了吗?
SELECT PAY_ATTR1.ID,
PAY_ATTR1.AMOUNT,
PAY_ATTR1.TAX,
ISSYNC = CASE WHEN PAY_ATTR1.AMOUNT != PAY_ATTR2.AMOUNT THEN 'DIFF' ELSE NULL END
FROM PAY_ATTR1
INNER JOIN PAY_ATTR2
ON PAY_ATTR1.ID=PAY_ATTR2.ID
ORA-00923:未找到FROM关键字
答案 0 :(得分:0)
SELECT PAY_ATTR1.ID,
PAY_ATTR1.AMOUNT,
PAY_ATTR1.TAX,
CASE WHEN PAY_ATTR1.AMOUNT != PAY_ATTR2.AMOUNT THEN 'DIFF' END as ISSYNC
FROM PAY_ATTR1
INNER JOIN PAY_ATTR2
ON PAY_ATTR1.ID=PAY_ATTR2.ID
答案 1 :(得分:0)
SELECT PAY_ATTR1.ID,
PAY_ATTR1.AMOUNT,
PAY_ATTR1.TAX,
CASE WHEN PAY_ATTR1.AMOUNT != PAY_ATTR2.AMOUNT THEN 'DIFF'
ELSE NULL
END AS ISSYNC
FROM PAY_ATTR1 INNER JOIN PAY_ATTR2
ON PAY_ATTR1.ID = PAY_ATTR2.ID