Solved

How to correct ORA-00918- Column ambiguously defined

Posted on 2007-11-29
2
2,342 Views
Last Modified: 2013-12-07
Need to correct this query
select matrectrans.itemnum,matrectrans.LINETYPE, matrectrans.GLDEBITACCT,
matrectrans.assetnum,matrectrans.location,
matrectrans.tostoreloc, matrectrans.ISSUETYPE,matrectrans.refwo,
matrectrans.ponum, matrectrans.quantity,
matrectrans.linecost, matrectrans.description,matrectrans.status,
matrectrans.siteid,matrectrans.actualdate, po.vendor, companies.name
from matrectrans left outer join po
on matrectrans.ponum = po.ponum
and matrectrans.siteid = po.siteid,
companies left outer join po
on po.orgid = companies.orgid
0
Comment
Question by:ewgf2002
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 20373262
I think you query should rather go like this:
select matrectrans.itemnum,matrectrans.LINETYPE, matrectrans.GLDEBITACCT, 
matrectrans.assetnum,matrectrans.location,
matrectrans.tostoreloc, matrectrans.ISSUETYPE,matrectrans.refwo,
matrectrans.ponum, matrectrans.quantity,
matrectrans.linecost, matrectrans.description,matrectrans.status,
matrectrans.siteid,matrectrans.actualdate, po.vendor, companies.name
from matrectrans 
left outer join po 
on matrectrans.ponum = po.ponum
and matrectrans.siteid = po.siteid
left outer join companies 
   on po.orgid = companies.orgid

Open in new window

0
 
LVL 14

Assisted Solution

by:GGuzdziol
GGuzdziol earned 250 total points
ID: 20373280
You use po table twice in outer join; I guess you wanted

from matrectrans left outer join po
on matrectrans.ponum = po.ponum and matrectrans.siteid = po.siteid
right outer join companies on po.orgid = companies.orgid

(or maybe left outer join? I do not know your logic, but I'm pretty sure you need po table once; this will give you proper data and get rid of ORA-00918. If you need po table twice in from clause then you have to alias it, i.e.
from ... left outer join po po1 on ... left outer join po po2 on ...)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle Pivot 2 43
query returning everything 11 87
How do I get sql developer to give me valuable exception information? 2 46
oracle 11g 23 46
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to recover a database from a user managed backup

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now