If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Select error?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-03-04, 05:18
Neba Neba is offline
Registered User
 
Join Date: Feb 2004
Posts: 4
Select error?

Hi can someone tell me what is wrong with the following statement.

SQL> select mcode, mname, avg(cmark) from result, module
2 where result.mcode = module.mcode
3 order by cmark desc;

select mcode, mname, avg(cmark) from result, module
*
ERROR at line 1:
ORA-00918: column ambiguously defined

thanx
Reply With Quote
  #2 (permalink)  
Old 03-03-04, 06:19
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
SQL> select mcode, mname, avg(cmark) from result, module
2 where result.mcode = module.mcode
3 order by cmark desc;

Column mcode (or all of them) exists in both of the tables, and it is unknown which one of those you want to select. Obviously, the result will be the same, but you have to specify the table (or its alias), such as

PHP Code:
select r.mcodem.mnameavg(r.cmark)
from result rmodule m
where r
.mcode m.mcode
order by r
.cmark desc
Reply With Quote
  #3 (permalink)  
Old 03-03-04, 07:18
Neba Neba is offline
Registered User
 
Join Date: Feb 2004
Posts: 4
ok than for the reply.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On