Solved

Join on a open rowset

Posted on 2008-10-03
3
330 Views
Last Modified: 2012-05-05
hi there,
I have a query that need to be join with another query that comes from another database. I have an open rowset and it works how can i achieve this?
here the open rowset:
SELECT a.*
FROM OPENROWSET('SQLOLEDB','GIS';'gisinq';'gisinq',
   'SELECT FOLIO, [NAME] FROM gis.PARCELS_HOMEOWNERS_ASSOCIATIONS ORDER BY [NAME]') AS a

and need to be link with this query:
SELECT DISTINCT uvw_PV_LOOKUP.NUMBER_KEY, uvw_PV_LOOKUP.ENTERED_DATE, tblAddressLookup.NAME_LINE_1,
       tblAddressLookup.NAME_LINE_2, tblAddressLookup.MAILING_ADDRESS, tblAddressLookup.MAILING_ADDRESS_2,
      tblAddressLookup.SITUS_ADDRESS
FROM uvw_PV_LOOKUP left outer join tblAddressLookup
            on uvw_PV_LOOKUP.folio_NUMBER = tblAddressLookup.FOLIO_NUMBER
            left outer join --Here
where
      uvw_PV_LOOKUP.DATA_STATUS ='APPLIED'AND
      uvw_PV_LOOKUP.TYPE_DEPT = 'BUILDING' AND

How can i do this?
0
Comment
Question by:jsctechy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22633360
this should do:
SELECT DISTINCT uvw_PV_LOOKUP.NUMBER_KEY, uvw_PV_LOOKUP.ENTERED_DATE, tblAddressLookup.NAME_LINE_1,
       tblAddressLookup.NAME_LINE_2, tblAddressLookup.MAILING_ADDRESS, tblAddressLookup.MAILING_ADDRESS_2,
      tblAddressLookup.SITUS_ADDRESS, a.NAME
FROM uvw_PV_LOOKUP left outer join tblAddressLookup
            on uvw_PV_LOOKUP.folio_NUMBER = tblAddressLookup.FOLIO_NUMBER
            left outer join OPENROWSET('SQLOLEDB','GIS';'gisinq';'gisinq',
   'SELECT FOLIO, [NAME] FROM gis.PARCELS_HOMEOWNERS_ASSOCIATIONS ORDER BY [NAME]') AS a
  ON a.FOLIO = uvw_PV_LOOKUP.folio_NUMBER 
where
      uvw_PV_LOOKUP.DATA_STATUS ='APPLIED'AND
      uvw_PV_LOOKUP.TYPE_DEPT = 'BUILDING' AND

Open in new window

0
 
LVL 1

Author Comment

by:jsctechy
ID: 22633400
did you know i have that? i was missing the part ON a.FOLIO = uvw_PV_LOOKUP.folio_NUMBER  and it was giving me an error.

I guess i overlooked the query. too early in the morning i guess!
Thanks,
jsctechy
0
 
LVL 1

Author Closing Comment

by:jsctechy
ID: 31502729
Thanks for your help!
0

Featured Post

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question