Results 1 to 2 of 2

Thread: query

  1. #1
    Join Date
    Jun 2005
    Posts
    85

    Unanswered: query

    Hi,

    select * from test a where test.col1 = 1;

    The above query will not work and it will throw the error 'Invalid column name'. i.e if alias defined for a table, then the columns can be qualified only using using the alias. Is it true ? Is it true in all the places like "Group By', 'Order' , 'SELECT list' etc. Is that true in all databases, is it an ANSI standard ?

    Please advice,

    Thanks,
    MiraJ

  2. #2
    Join Date
    Nov 2002
    Posts
    272
    I don't know if it's ANSI standard, but if it isn't, it should be.

    Consider
    select a.* from emp a, emp b
    where b.emp_id = a.manager_id
    and emp.emp_id = 42

    Which emp table instance is referred to in the last line, a or b? You can't tell, so a database can't either.

Posting Permissions

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