Solved

Join on a open rowset

Posted on 2008-10-03
3
325 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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What type of testing am I doing? 4 75
rolling count by date, hour query 7 30
What is needed to become a DBA? 7 52
SQL Query 20 19
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

732 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