Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2003
    Posts
    114

    Unanswered: Join on a third table

    I currently have a join on 2 tables. An abbreviation of the code is as follow:

    sql = "SELECT pd.RaceID, ir.EventPl, ir.RacePl FROM PartData pd INNER JOIN IndResults ir ON pd.PartID = ir.PartID WHERE pd.RaceID = " & lRaceID & " ORDER By EventPl"

    Here's the problem: I need to change the WHERE clause to a field value from another table. How do I incorporate a join with a third table?

    Thanks!

  2. #2
    Join Date
    Apr 2003
    Location
    Israel
    Posts
    81
    select T1.*, T3.*
    from T1 join T2 on T1.id=T2.id join T3 on T2.altid = T3.id
    --
    kukuk

  3. #3
    Join Date
    Apr 2003
    Posts
    114

    Thanks, but...

    ...do I need to use JOIN as opposed to INNER JOIN? Also, do I need to give T2 and altid?

    Thanks!

  4. #4
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    Have you gone thru JOINS topic in books online, has got code examples so.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  5. #5
    Join Date
    Apr 2003
    Posts
    114

    Thank you

    I will do that!

Posting Permissions

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