Inner Join for three tables?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Inner Join for three tables?

  1. #1
    Join Date
    Dec 2005
    Posts
    30

    Inner Join for three tables?

    Hi guys!

    For two tables is working fine but for three tables i don't now how to do it?

    Here is my Select statemebt for two tables:
    Code:
    Dim strsql2 = "SELECT employe.*,location.* FROM employe INNER JOIN location ON employe.ID_employe = location.ID_employe WHERE employe.ID_employe = " & Form3.manipulatedRow & " "
    The third table that i wan't to add it is "job" that is also in relation with table employe.

    Please help me with my problem!

  2. #2
    Join Date
    Jun 2005
    Posts
    1,255

    Smile Re: Inner Join for three tables?

    You can use parenthesis:
    Code:
    Dim strsql2 = "SELECT employe.*, location.*, job.*
     FROM 
      (employe INNER JOIN location
       ON employe.ID_employe = location.ID_employe)
      INNER JOIN job
       ON employe.ID_employe = job.ID_employe 
     WHERE employe.ID_employe = " & Form3.manipulatedRow & " "
    Or you can use the old method, preferred by many programmers, including myself:
    Code:
    Dim strsql2 = "SELECT employe.*, location.*, job.*
     FROM employe, location, job
     WHERE employe.ID_employe = location.ID_employe
       AND employe.ID_employe = job.ID_employe 
       AND employe.ID_employe = " & Form3.manipulatedRow & " "

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center