wdwd dsd
wdwd dsd

Reputation: 25

getting the error in the below oracle query of inner join

I am executing the below query in oracle but I am getting an error on the execution of the below query , Please advise how to overcome from this specially the error come when i add the last clause of where condition in the query

SELECT  t.product_name FROM JOBCODE_PROJECT_TYPE_MAPPING p
INNER JOIN AOBCODE_UCT_MAPPING h 
ON p.ID = h.jobcode_id
INNER JOIN WISK_UCTS t
ON h.risk_product_id = t.risk_product_id AND p.id = h.jobcode_id;
where p.sp_job_code= 'Add';

Upvotes: 0

Views: 24

Answers (1)

Ori Marko
Ori Marko

Reputation: 58772

Remove second duplicate condition AND p.id = h.jobcode_id; which is irrelevant in the join context:

  SELECT  t.product_name FROM JOBCODE_PROJECT_TYPE_MAPPING p
 INNER JOIN AOBCODE_UCT_MAPPING h 
 ON p.ID = h.jobcode_id
 INNER JOIN WISK_UCTS t
 ON h.risk_product_id = t.risk_product_id 
 where p.sp_job_code= 'Add';

Upvotes: 2

Related Questions