Solved

How to correct ORA-00918- Column ambiguously defined

Posted on 2007-11-29
2
2,355 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 report printing 2 pages in one page 2 69
Schema creation in Oracle12c 6 48
Oracle DB monitor SW 21 48
run sql script from putty 4 35
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

773 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