Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Jofo
Starting Member
2 Posts |
Posted - 2009-09-21 : 20:17:30
|
I have two tables, CUSTOMERS(cid, cname) and ORDERS(ordnum, cid, pid). I'm trying to list all the cid values of customers that correspond to the pid values 'p01' and 'p02'.Here is the code I enter:SQL> SELECT cid FROM customers JOIN orders ON customers.cid = orders.cid WHERE pid='p01' OR pid='p02'; And this is the message I get:ERROR at line 1:ORA-00918: column ambiguously defined I can't figure out why I'm getting this error when I can swap out "SELECT cid" for "SELECT cname" and it works just fine. I'd really appreciate some help. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-09-21 : 21:19:16
|
try posting at orafaq.com or dbforums.com.SQLTeam is a Microsoft SQL Server forum KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-09-21 : 21:20:09
|
anyway . . . you have cid in both customers and orders table. Prefix it with the table nameSELECT customers.cid FROM customers JOIN orders ON customers.cid = orders.cid WHERE pid='p01' OR pid='p02'; KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Jofo
Starting Member
2 Posts |
Posted - 2009-09-21 : 22:18:32
|
| Ah, sorry. I'm completely new to this stuff so I didn't realize that this forum pertains to something different.That did the trick though, so thanks! |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-09-21 : 22:20:45
|
no worries. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|