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. Can you JOIN a Subquery

Can you JOIN a Subquery

Scheduled Pinned Locked Moved Database
question
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.
  • L Offline
    L Offline
    Larsenal
    wrote on last edited by
    #1

    I am running Access 2002. I want to do something similar to the following:

    SELECT * FROM tb1
    LEFT JOIN
    ( SELECT tb2.ID AS tb2_ID, tb2.Author AS tb2_Author, tb2.Address AS tb3_Address
    FROM tb2, tb3
    WHERE tb2.Address = tb3.ID ) AS sb1
    ON sb1.tb2_ID = tb1.Author

    How can I do that? ---- to die is gain

    J 1 Reply Last reply
    0
    • L Larsenal

      I am running Access 2002. I want to do something similar to the following:

      SELECT * FROM tb1
      LEFT JOIN
      ( SELECT tb2.ID AS tb2_ID, tb2.Author AS tb2_Author, tb2.Address AS tb3_Address
      FROM tb2, tb3
      WHERE tb2.Address = tb3.ID ) AS sb1
      ON sb1.tb2_ID = tb1.Author

      How can I do that? ---- to die is gain

      J Offline
      J Offline
      jasncab
      wrote on last edited by
      #2

      Yes you can really close to what you have already. You are joining from the sub out. and that should be ok. Its called a correlated sub query.. The problem is I dont see your point in this particular example. It could be that I am just missing it. But really you could just rewrite your example SELECT tb1.namedfields, AS tb2_ID, tb2.Author AS tb2_Author, tb2.Address AS tb3_Address FROM tb1 LEFT JOIN tb2.author ON FROM tb2.id = tb1.id left join tb3 on tb2.Address = tb3.ID http://www.jasncab.com/huberblog :: Jason Huber

      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