我正在尝试在Oracle数据库的CR XI中创建一个union作为命令。但是,当我尝试保存命令时,表明'找不到FROM关键字'。
代码好吗?有任何想法吗?
SELECT *, "H3" as "Type" FROM TABLEH3
WHERE CURRENT_FLAG = '1'
UNION ALL
SELECT *, "H4" as "Type" FROM TABLEH4
WHERE CURRENT_FLAG = '1'
UNION ALL
SELECT *, "H5" AS "Type" FROM TABLEH5
WHERE CURRENT_FLAG = '1'
UNION ALL
SELECT *, "'H6" AS "Type" FROM TABLEH6
WHERE CURRENT_FLAG = '1';
干杯
布伦丹
我没有你的表结构,但这可能适合你,你需要别名*引用的表
SELECT t1.*, 'H3' as "Type" FROM TABLEH3 t1
WHERE CURRENT_FLAG = '1'
UNION ALL
SELECT t4.*, 'H4' as "Type" FROM TABLEH4 t4
WHERE CURRENT_FLAG = '1'
UNION ALL
SELECT t5.*, 'H5' AS "Type" FROM TABLEH5 t5
WHERE CURRENT_FLAG = '1'
UNION ALL
SELECT t6.*, 'H6' AS "Type" FROM TABLEH6 t6
WHERE CURRENT_FLAG = '1';