找不到预期的From Keyword-Oracle CRXI命令

时间:2018-06-26 10:26:33

标签: oracle crystal-reports

我正在尝试在Oracle数据库的CR XI中创建一个联合作为命令。但是,当我尝试保存命令时,指出“未在期望的位置找到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';

欢呼

布伦丹

1 个答案:

答案 0 :(得分: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';