找不到列或全局变量 db2
Column or global variable not found db2
我遇到了 DB2 问题。
我有两个具有相同结构数据库的库。唯一的区别是数据。
当我尝试这个 sql 对第一个库的请求时,它起作用了
SELECT *
FROM Z24FR.CLIENT, Z24FR.EMPLOYE
WHERE CLIENT.CLINUM = EMPLOYE.CLINUM
但是当我尝试使用其他库时,我遇到了这个错误。
SELECT *
FROM Z24UK.CLIENT, Z24UK.EMPLOYE
WHERE CLIENT.CLINUM = EMPLOYE.CLINUM
Column or global variable CLINUM not found.
CLINUM was not found as a column of table *N in *N and was not found as a global variable in *N. If the table is *N, CLINUM is not a column of any table or view that can be referenced.
我检查了 CLIENT 和 EMPLOYE 表,它们有包含数据的列。
提前感谢您的回答
限定列的方式取决于表的“声明”方式
所以如果你想要一些通用的东西,你可以编写代码
SELECT *
FROM Z24xx.CLIENT CLIENT, Z24xx.EMPLOYE EMPLOYE
WHERE CLIENT.CLINUM = EMPLOYE.CLINUM
或者因为逗号符号太旧了,不太可读
SELECT
*
FROM Z24xx.CLIENT CLIENT
inner join Z24xx.EMPLOYE EMPLOYE on CLIENT.CLINUM = EMPLOYE.CLINUM
我遇到了 DB2 问题。
我有两个具有相同结构数据库的库。唯一的区别是数据。
当我尝试这个 sql 对第一个库的请求时,它起作用了
SELECT *
FROM Z24FR.CLIENT, Z24FR.EMPLOYE
WHERE CLIENT.CLINUM = EMPLOYE.CLINUM
但是当我尝试使用其他库时,我遇到了这个错误。
SELECT *
FROM Z24UK.CLIENT, Z24UK.EMPLOYE
WHERE CLIENT.CLINUM = EMPLOYE.CLINUM
Column or global variable CLINUM not found.
CLINUM was not found as a column of table *N in *N and was not found as a global variable in *N. If the table is *N, CLINUM is not a column of any table or view that can be referenced.
我检查了 CLIENT 和 EMPLOYE 表,它们有包含数据的列。
提前感谢您的回答
限定列的方式取决于表的“声明”方式
所以如果你想要一些通用的东西,你可以编写代码
SELECT *
FROM Z24xx.CLIENT CLIENT, Z24xx.EMPLOYE EMPLOYE
WHERE CLIENT.CLINUM = EMPLOYE.CLINUM
或者因为逗号符号太旧了,不太可读
SELECT
*
FROM Z24xx.CLIENT CLIENT
inner join Z24xx.EMPLOYE EMPLOYE on CLIENT.CLINUM = EMPLOYE.CLINUM