what's the problem with the query?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: what's the problem with the query?

  1. #1
    Join Date
    Apr 2002
    Posts
    2

    Exclamation

    suppose there are two tables
    1_t (a,b,c)
    2_t(d,e)
    and other_name means to have the alias for the records chose

    select a, b
    (select d from 2_t where d=1 and e=2) other_name,

    from 1_t
    where b between 1 and 2
    and c = 3
    order by a, b;

  2. #2
    Join Date
    Mar 2002
    Location
    Mesa, Arizona
    Posts
    1,204
    First ...

    select a, b, <-- see the comma
    "I do not fear computers. I fear the lack of them." Isaac Asimov
    Oracle Scirpts DBA's need

  3. #3
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    It would help us a lot if you provide an ORA error you are getting with your query.

    At a first glance, I would say your query is missing a comma between column b and your subselect:

    select a, b,
    (select d from 2_t where d=1 and e=2) other_name,
    from 1_t
    where b between 1 and 2
    and c = 3
    order by a, b;
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  4. #4
    Join Date
    Aug 2000
    Posts
    462
    lose the , after other_name
    Oracle DBA and Developer

  5. #5
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Originally posted by kmesser
    lose the , after other_name
    Yeah, that too. Good catch!
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

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



Click Here to Expand Forum to Full Width