Help with simple query...
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Help with simple query...

  1. #1
    Join Date
    Sep 2000
    Location
    VA
    Posts
    343
    Hi all,

    Say I have 2 tables, table1 with columns a,b & c, and table2 with columns a,b, & d.

    Now I need to write a query to pull out the records from table1 whose column a & b matches with that of table2. How do I do it?
    I know there is a simple way out, but what is it?

    Shiva.

  2. #2
    Join Date
    Feb 2001
    Posts
    123
    select table1.a, table1.b, table1.c
    from table1, table2
    where table1.a = table2.a
    and table1.b = table2.b;


    HTH

    David.

  3. #3
    Join Date
    May 2001
    Posts
    31
    select * from table1
    where exists
    (select null from table2 where
    table1.a=table2.a and
    table1.b=table2.b)

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