我正在研究oracle数据库,我想从2个表中获取数据。所以我正在使用join。我的表格如下,
CUSTOMER_DTLS_TBL
CUST_ID CUST_CODE
68 A2157021570
CUSTOMER_MAPPING_TBL
ID AMOUNT CUST_ID CODE PID
1 200 68 A2157021570 383
2 800 68 A2157021570 392
// NO RECORD FOUND
SELECT CDT.CUST_ID,CDT.CUST_CODE,CMT.AMOUNT,CMT.PID
FROM CUSTOMER_DTLS_TBL CDT, CUSTOMER_MAPPING_TBL CMT
WHERE CDT.CUST_ID = CMT.CUST_ID(+)
AND CMT.PID = 383;
// 1 RECORD FOUND
SELECT CDT.CUST_ID,CDT.CUST_CODE,CMT.AMOUNT,CMT.PID
FROM CUSTOMER_DTLS_TBL CDT, CUSTOMER_MAPPING_TBL CMT
WHERE CDT.CUST_ID = CMT.CUST_ID(+)
AND CMT.PID = 392;
我运行第一个查询时的预期输出是:
68 A2157021570 200 383