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. Need to fetch from two data sources

Need to fetch from two data sources

Scheduled Pinned Locked Moved Database
databasetutorialworkspace
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.
  • A Offline
    A Offline
    avi_dadi2002
    wrote on last edited by
    #1

    Hi, I need to fetch data from two different data sources in a single select query in DB2 environment. For Example. My DB@ env has two are different data sources named as XXX5T and XXXXX5P. Each data source(Host) has multiple databases, i want to fetch some records from two different tables, one table is available in XXX5T and 2nd one exist in XXXXX5P. Select p,q,r from XXX5T.MyDB5T.MyTable a INNER JOIN XXX5P.MyDB5P.MyTable b on a.id= b.id. Thanks in advance.

    R 1 Reply Last reply
    0
    • A avi_dadi2002

      Hi, I need to fetch data from two different data sources in a single select query in DB2 environment. For Example. My DB@ env has two are different data sources named as XXX5T and XXXXX5P. Each data source(Host) has multiple databases, i want to fetch some records from two different tables, one table is available in XXX5T and 2nd one exist in XXXXX5P. Select p,q,r from XXX5T.MyDB5T.MyTable a INNER JOIN XXX5P.MyDB5P.MyTable b on a.id= b.id. Thanks in advance.

      R Offline
      R Offline
      Richard Berry100
      wrote on last edited by
      #2

      Sorry - never read your question properly... (Not sure about DB2) but in any case... Perhaps UNION ALL is what you are looking for. (Columns in both selects must be the same) select p, q, r from XXX5T.MyDB5T.MyTable UNION ALL select p, q, r from XXX5T.MyDB5P.MyTable also see Linked Servers http://msdn.microsoft.com/en-us/library/ms188279.aspx[^]

      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