DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: SQL Problem

Hybrid View

  1. #1
    Join Date
    Nov 1999
    Posts
    226
    Hi

    Incase I want to check out the presence of two columns in a table how do I do that .

    select (ordernum,date ) from table_name A where (order_num,date) in (Select (order_num,date) from table_name B.

    Gives me an error
    and

    if I write

    select (ordernum,date ) from table_name A where exists (Select (ordernum,date ) from table_name B) gives me all orders and treats order_num and date as seperate columsn .

    Please help

    regards

  2. #2
    Join Date
    Mar 2001
    Posts
    1
    It looks like you have extra parenthesis in your subquery

    try this instead

    select (ordernum,date ) from table_name A where (order_num,date) in (Select order_num,date from table_name B)




  3. #3
    Join Date
    Dec 2000
    Posts
    12

    Unhappy

    Return the foll. error.

    select (ordernum,date ) from table_name A where exists
    *
    ERROR at line 1:
    ORA-00907: missing right parenthesis

  4. #4
    Join Date
    Nov 1999
    Posts
    226
    Guys!!

    I am sorry about the bracket but it is the logic that I am looking for . I want to find out the columns in a table A which are similar to two columns in table B .

    Please refer to my SQL and disregard the bracket error

    How do i do that

    thanks

  5. #5
    Join Date
    Feb 2001
    Posts
    184
    Try This, Hopefully shoule be fine,

    Select c1, c2 From Table1 a
    where exists (select c1, c2 from table2 b where a.c1=b.c1 and a.c2=b.c2)

    You should be fine,

    Thanks

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