我有一个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和employee表,它们有包含数据的列。
提前感谢您的回答
限定列的方式取决于表的"声明"方式
参见表指示符
如果你想要一些通用的东西你可以写
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