Home » SQL & PL/SQL » SQL & PL/SQL » Need the solution for the following SQL giving 00918 error(Merged)
Need the solution for the following SQL giving 00918 error(Merged) [message #225230] 
Mon, 19 March 2007 04:27 
udaykiran3003
Messages: 5 Registered: March 2007

Junior Member 


SELECT
NVL(A.CUSTOMER_SK, B.BCUSTOMER_SK) ACUSTOMER_SK,
NVL(A.INVOICE_DT_SK,B.BPOS_DT_SK) ADATE_SK,
NVL(A.PRODUCT_SK,B.BPRODUCT_SK) APRODUCT_SK,
B.BDOOR_SK ADOOR_SK,
NVL(B.BAMOUNT,0) AAMOUNT,
NVL(B.BQUANTITY,0) AQUANTITY,
NVL(B.BSUG_RET_PRICE,0) ASUG_RET_PRICE
FROM
DATE_TIME D,INVOICE_FACT A
FULL OUTER JOIN
(SELECT
POS.CUSTOMER_SK BCUSTOMER_SK,
POS.DOOR_SK BDOOR_SK,
P.PRODUCT_SK BPRODUCT_SK,
POS.SALES_DT_SK BPOS_DT_SK,
VM.MONTH_NUMBER_IN_MONTH BMNM,
SUM(POS.AMOUNT) BAMOUNT,
SUM(POS.QUANTITY) BQUANTITY,
MAX(P.SUG_RET_PRICE) BSUG_RET_PRICE
FROM
V_MONTH VM,DATE_TIME DT, PRODUCT_MASTER P, POS_FACT_CN POS
WHERE
P.PRODUCT_SK=POS.PRODUCT_SK AND
DT.CALENDAR_SK=POS.SALES_DT_SK AND
DT.CALENDAR_YEAR=VM.CALENDAR_YEAR
GROUP BY POS.CUSTOMER_SK, POS.DOOR_SK , POS.PRODUCT_SK ,POS.SALES_DT_SK,VM.MONTH_NUMBER_IN_MONTH) B ON
A.CUSTOMER_SK = B.BCUSTOMER_SK AND A.PRODUCT_SK = B.BPRODUCT_SK
WHERE
D.MONTH_NUMBER_IN_MONTH=B.BMNM
Is my query and i am getting 00918 error plz help me




Re: Need the solution for the following SQL giving 00918 error [message #225233 is a reply to message #225231] 
Mon, 19 March 2007 04:32 
udaykiran3003
Messages: 5 Registered: March 2007

Junior Member 


SQL> SELECT
2 NVL(A.CUSTOMER_SK, B.BCUSTOMER_SK) ACUSTOMER_SK,
3 NVL(A.INVOICE_DT_SK,B.BPOS_DT_SK) ADATE_SK,
4 NVL(A.PRODUCT_SK,B.BPRODUCT_SK) APRODUCT_SK,
5 B.BDOOR_SK ADOOR_SK,
6 NVL(B.BAMOUNT,0) AAMOUNT,
7 NVL(B.BQUANTITY,0) AQUANTITY,
8 NVL(B.BSUG_RET_PRICE,0) ASUG_RET_PRICE
9 FROM
10 DATE_TIME D,INVOICE_FACT A
11 FULL OUTER JOIN
12 (SELECT
13 POS.CUSTOMER_SK BCUSTOMER_SK,
14 POS.DOOR_SK BDOOR_SK,
15 P.PRODUCT_SK BPRODUCT_SK,
16 POS.SALES_DT_SK BPOS_DT_SK,
17 VM.MONTH_NUMBER_IN_MONTH BMNM,
18 SUM(POS.AMOUNT) BAMOUNT,
19 SUM(POS.QUANTITY) BQUANTITY,
20 MAX(P.SUG_RET_PRICE) BSUG_RET_PRICE
21 FROM
22 V_MONTH VM,DATE_TIME DT, PRODUCT_MASTER P, POS_FACT_CN POS
23 WHERE
24 P.PRODUCT_SK=POS.PRODUCT_SK AND
25 DT.CALENDAR_SK=POS.SALES_DT_SK AND
26 DT.CALENDAR_YEAR=VM.CALENDAR_YEAR
27 GROUP BY POS.CUSTOMER_SK, POS.DOOR_SK , POS.PRODUCT_SK ,POS.SALES_DT_SK,VM.MONTH_NUMBER_IN_MON
TH) B ON
28 A.CUSTOMER_SK = B.BCUSTOMER_SK AND A.PRODUCT_SK = B.BPRODUCT_SK
29 WHERE
30 D.MONTH_NUMBER_IN_MONTH=B.BMNM
31 /
DT.CALENDAR_YEAR=VM.CALENDAR_YEAR
*
ERROR at line 26:
ORA00918: column ambiguously defined



Need solution for the following problem [message #225234 is a reply to message #225230] 
Mon, 19 March 2007 04:33 
udaykiran3003
Messages: 5 Registered: March 2007

Junior Member 


SQL> SELECT
2 NVL(A.CUSTOMER_SK, B.BCUSTOMER_SK) ACUSTOMER_SK,
3 NVL(A.INVOICE_DT_SK,B.BPOS_DT_SK) ADATE_SK,
4 NVL(A.PRODUCT_SK,B.BPRODUCT_SK) APRODUCT_SK,
5 B.BDOOR_SK ADOOR_SK,
6 NVL(B.BAMOUNT,0) AAMOUNT,
7 NVL(B.BQUANTITY,0) AQUANTITY,
8 NVL(B.BSUG_RET_PRICE,0) ASUG_RET_PRICE
9 FROM
10 DATE_TIME D,INVOICE_FACT A
11 FULL OUTER JOIN
12 (SELECT
13 POS.CUSTOMER_SK BCUSTOMER_SK,
14 POS.DOOR_SK BDOOR_SK,
15 P.PRODUCT_SK BPRODUCT_SK,
16 POS.SALES_DT_SK BPOS_DT_SK,
17 VM.MONTH_NUMBER_IN_MONTH BMNM,
18 SUM(POS.AMOUNT) BAMOUNT,
19 SUM(POS.QUANTITY) BQUANTITY,
20 MAX(P.SUG_RET_PRICE) BSUG_RET_PRICE
21 FROM
22 V_MONTH VM,DATE_TIME DT, PRODUCT_MASTER P, POS_FACT_CN POS
23 WHERE
24 P.PRODUCT_SK=POS.PRODUCT_SK AND
25 DT.CALENDAR_SK=POS.SALES_DT_SK AND
26 DT.CALENDAR_YEAR=VM.CALENDAR_YEAR
27 GROUP BY POS.CUSTOMER_SK, POS.DOOR_SK , POS.PRODUCT_SK ,POS.SALES_DT_SK,VM.MONTH_NUMBER_IN_MON
TH) B ON
28 A.CUSTOMER_SK = B.BCUSTOMER_SK AND A.PRODUCT_SK = B.BPRODUCT_SK
29 WHERE
30 D.MONTH_NUMBER_IN_MONTH=B.BMNM
31 /
DT.CALENDAR_YEAR=VM.CALENDAR_YEAR
*
ERROR at line 26:
ORA00918: column ambiguously defined










Goto Forum:
Current Time: Mon Mar 27 13:33:43 CDT 2017
Total time taken to generate the page: 0.11068 seconds
