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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Selecting from three tables?

Selecting from three tables?

Scheduled Pinned Locked Moved Database
databasehelpquestion
2 Posts 2 Posters 0 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.
  • N Offline
    N Offline
    NewToAspDotNet
    wrote on last edited by
    #1

    Hi all, i have three tables: table 1 has two colomns: name and id table 2 has two columns: countrycode and id(id in this table is the forgin key from table one) table 3 has two columns: countryname and countrycode(countrycode is the forggin key from table two) now i have to make a query to select the name from table one and the countryname that belongs to that name from table three :~ . can anyone help me to make this query??? Thanx.

    L 1 Reply Last reply
    0
    • N NewToAspDotNet

      Hi all, i have three tables: table 1 has two colomns: name and id table 2 has two columns: countrycode and id(id in this table is the forgin key from table one) table 3 has two columns: countryname and countrycode(countrycode is the forggin key from table two) now i have to make a query to select the name from table one and the countryname that belongs to that name from table three :~ . can anyone help me to make this query??? Thanx.

      L Offline
      L Offline
      leoinfo
      wrote on last edited by
      #2

      SELECT t1.name, t3.countryname
      FROM [table 1] as t1
      INNER JOIN [table 2] as t2 ON t2.id = t1.id
      INNER JOIN [table 3] as t3 ON t3.countrycode = t2.countrycode

      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