Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How Can I Join more than two tables in SQL

How Can I Join more than two tables in SQL

Scheduled Pinned Locked Moved Database
databasequestion
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JawedVikia80
    wrote on last edited by
    #1

    Hi friends This is my first post in the Forum. How Can I Join more than two tables in SQL.

    C W 2 Replies Last reply
    0
    • J JawedVikia80

      Hi friends This is my first post in the Forum. How Can I Join more than two tables in SQL.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      JawedVikia80 wrote: How Can I Join more than two tables in SQL. Same way as you join two tables, just keep using joins until you've joined all the tables you need. For Example:

      SELECT TableA.ID as AID, TableB.ID as BID, TableC.ID as CID
      FROM TableA
      INNER JOIN TableB ON TableA.ID = TableB.AID
      INNER JOIN TableC ON TableB.ID = TableC.BID

      This example supposes there are one-to-many relationships between TableA & TableB and also between TableB & TableC. And that TableB has a foreign key to tableA called AID, and also TableC has a foreign key to TableB called BID Does this help?


      "You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar The Second EuroCPian Event will be in Brussels on the 4th of September Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way! My Blog

      1 Reply Last reply
      0
      • J JawedVikia80

        Hi friends This is my first post in the Forum. How Can I Join more than two tables in SQL.

        W Offline
        W Offline
        wgdesigner
        wrote on last edited by
        #3

        Dear Friend There are many types of the Joins. which type of the join u want to use?? 1-Inner join 2-Outer join 3-Self Join You have example of inner join by our one friend if u need other 2's then reply.. Raj Khatri

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups