Results 1 to 5 of 5

Thread: SQL - Using Two Different Tables ??

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Post

    What would be the correct SQL syntax for the following:

    example : I have two tabeles
    1. Baset_Ball_Players
    2. Students

    in the table Baset_Ball_Players there is a field called Player_Name and in Students there is a field called Student_Name.

    How could I do a search to find all the matches where Player_Name = Student_Name.

    Just like finding the Names that are similar in the two tables.

    Another question, is this possible with two seperate database files??


    ------------------
    OmarSwan

    [email protected]

    http://omarswan.da.ru/


    "Jesus is Lord"

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    Like this:

    SELECT Baset_Ball_Players.Name
    FROM Baset_Ball_Players INNER JOIN Students ON Baset_Ball_Players.Name = Students.Name;

    Not sure about using 2 databases
    What you could do though is put a link in one database to the 2nd one and then treat it as one database.


    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Post

    Thanks Alot Mark

    ------------------
    OmarSwan

    [email protected]

    http://omarswan.da.ru/


    "Jesus is Lord"

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    For two separate database tables, I believe you will have to use the ADO SHAPE command to relate tables that are not in the same database.

  5. #5
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Depending on the size of your tables and what you want to find, it might be more efficient to use a sub-query.

    such as

    SELECT Name
    FROM Baset_Ball_Players
    where Name in (select distinct(Name) from students)

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