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