Results 1 to 3 of 3

Thread: Select error?

  1. #1
    Join Date
    Feb 2004
    Posts
    4

    Unanswered: 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

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    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

  3. #3
    Join Date
    Feb 2004
    Posts
    4
    ok than for the reply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •