Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
EnquiryID | OpenedDate | UPRN | USRN | EnquiryType | Alt_Addr |
---|---|---|---|---|---|
15 | 01/08/2010 | 185017614 | E | Y | |
16 | 01/08/2010 | 13146 | E | Y | |
17 | 01/08/2010 | 4036 | E | Y | |
18 | 01/08/2010 | 185136759 | E | Y |
AddressInfo Table
UPRN | USRN | WARD_NAME |
---|---|---|
185017614 | 5409 | GALWALLY |
185136759 | 3258 | LADYBROOK |
187350131 | 13146 | BOTANIC |
187350128 | 4036 | DUNMURRY |
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.
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;
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.