1

当我运行以下两个 CUST_NUM 不明确的查询时,我不断收到错误消息。我怎样才能解决这个问题?

SELECT  INV_NUM, CUST_NUM, CUST_LNAME, CUST_FNAME, INV_DATE, INV_AMOUNT
FROM    CH08_INVOICE i 
INNER JOIN CH08_CUSTOMER c1 ON (i.CUST_NUM = c1.CUST_NUM)
WHERE   CUST_BALANCE>=1000;


SELECT CUST_LNAME, CUST_FNAME 
FROM CH08_CUSTOMER c1 JOIN CH08_CUSTOMER_2 c2
ON (c1.CUST_LNAME = c2.CUST_LNAME AND c1.CUST_FNAME = c2.CUST_FNAME);
4

2 回答 2

1
SELECT i.INV_NUM, i.CUST_NUM, i.CUST_LNAME, i.CUST_FNAME, i.INV_DATE, i.INV_AMOUNT FROM CH08_INVOICE i INNER JOIN CH08_CUSTOMER c1 ON (i.CUST_NUM = c1.CUST_NUM) WHERE i.CUST_BALANCE>=1000;

SELECT c1.CUST_LNAME, c1CUST_FNAME FROM CH08_CUSTOMER c1 JOIN CH08_CUSTOMER_2 c2 ON (c1.CUST_LNAME = c2.CUST_LNAME AND c1.CUST_FNAME = c2.CUST_FNAME);

请检查此查询

于 2015-10-07T03:24:51.693 回答
1

不明确的列意味着数据库不知道它必须使用哪个表的列。

尝试使用

SELECT  INV_NUM, i.CUST_NUM ...

或者

SELECT  INV_NUM, c1.CUST_NUM ...

用于明确定义表。

于 2015-10-07T03:25:38.150 回答