Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Two Fields in Two tables - How to link?

I'm sure this is a common enough issue, but I cannot get my head around how to fix it. In my opinion it is a problem with the way the original data is set up but I don't think that can be helped at this stage.


I have two Tables:

EnquirySummary Table

EnquiryIDOpenedDate
UPRN
USRN
EnquiryTypeAlt_Addr
1501/08/2010185017614
EY
1601/08/2010
13146EY
1701/08/2010
4036EY
1801/08/2010185136759
EY

AddressInfo Table

UPRN
USRNWARD_NAME
1850176145409GALWALLY
1851367593258LADYBROOK
18735013113146BOTANIC
1873501284036DUNMURRY



So as you can see, both tables have a UPRN or a USRN column

I need to be able to filter the Enquirys table down using the Ward Name

Each row in EnquirySummary will only have either a UPRN or a USRN, not both. The AddressInfo table holds both.

As it is, Qlikview willl create a synthetic table inbetween.

I tried creating a unique Key of combined UPRN and USRN concatenated but it wont work as obviously the records in EnquirySummary will never have both values in their key.

11 Replies
Not applicable
Author

Unfortunately they are two different servers.

PointerGrab:

BUFFER (Stale After 24 hours)

CONNECT TO [Provider=MSDAORA.1;User ID=Pointer;Data Source=BCRM] (XPassword is COVNHYdNJTbIXSJOOA);

LOAD

    UPRN,

    USRN,

    "WARD_NAME";

SQL SELECT *

FROM POINTER."POINTERPLUS_V2"

WHERE TOWN = 'BELFAST';

CONNECT TO [Provider=MSDAORA.1;User ID=corpdev;Data Source=safecity] (XPassword is YCdeBWFNWLZWJ);

CTS_ENQUIRY_SUMMARY:

BUFFER (Stale After 24 hours)

LOAD

ENQUIRYTYPE,

DayStart(OPENEDDATE) As OPENEDDATE,

ALT_ADDR,

UPRN,

STREET_NO As USRN,

ENQUIRY AS ENQUIRY_ID

WHERE

ENQUIRYTYPE='E'

;

SQL SELECT *

FROM CORPDEV."CTS_ENQUIRY_SUMMARY"

ORDER BY OPENEDDATE ASC;

Not applicable
Author

Well you may still be able to, but I can't test this for you. You have to put the @servername after the table and use aliases. You might need to put in quote marks somewhere in the names of the schema's, tables and servers, not sure.

Let see, based on your script I would say safecity and BCRM are the database names right? I think you could try:

SELECT Enquiry as Enquiry_ID,
OpenedDate,
COALESCE( E.UPRN, A.UPRN) as UPRN,
EnquiryType,
Alt_Addr
FROM CORPDEV.CTS_ENQUIRY_SUMMARY@safecity E

LEFT JOIN POINTER.POINTERPLUS_V2@BCRM A

on E.USRN = A.USRN

If this works, the other table you can ofc just load plainly.