- SQL code
[code=SQL]
CASE WHEN A.NUM=B.NUM THEN 'yes' ELSE‘no’END,
CASE WHEN A.NUM=C.NUM THEN 'yes' ELSE‘no’END,
FROM TABLE A,
(SELECT T.NUM WHERE TABLE_B T WHERE T.FLAG=1)B,
(SELECT T.NUM WHERE TABLE_C T WHERE T.FLAG=2)C
WHERE A.NUM=B.NUM THEN(+)
AND A.NUM=C.NUM THEN(+)
结果正确不 [/code]
------解决方案--------------------
如果字段名中含有空格,需要加双引号.
SELECT A.NAME,A.NUM,
CASE A.NUM WHEN B.NUM THEN 'yes' ELSE‘no’END,
CASE A.NUM WHEN C.NUM THEN 'yes' ELSE‘no’END
FROM TABLE A,
(SELECT T.NUM WHERE TABLE_B T WHERE T.FLAG=1)B,
(SELECT T.NUM WHERE TABLE_C T WHERE T.FLAG=2)C
WHERE A.NUM=B.NUM(+)
AND A.NUM=C.NUM(+)