Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
raynac
Partner - Creator
Partner - Creator

Script Join Problem

Hi All,

I am hoping you can come to my rescue with respect to an issue I am having.

My database has buildings; each building is assigned to a property.  SO my gbbuilding table has (for example):

Building     Property

1               A

2               B

3               B

4               C

5               D

6               D

And so on.

I have a booking table, which includes a building code.  There is a table I need to join to that has several fields in common, but instead of the building code, it has the property code.  How the heck do I join these from the SQL statement standpoint?

SQL SELECT *

FROM cmsvbook b LEFT OUTER JOIN cmprovable p

ON b.service_type=p.service_type

    AND b.service_detail=p.service_detail

    AND b.provider_code=p.provider_code

   and b.building_code=p.property_code; 


This was how it was written long before I got the view, and might have worked in theory once upon a time.  It's now wrong because, for many of my clients these days, the building code and property code can be, and  usually are, different.  I need to "go through" gbbuilding and swap out the b.building_code for the correct property code that I need.

Does anyone know how to make this work?

TIA!

2 Replies
ahaahaaha
Partner - Master
Partner - Master

Hi Rayna,

Sorry for such a idea. Can make sense first to directly download all the tables from SQL to Qlik, and only then to impose conditions and bind them between themselves?

Regards,

Andrey

raynac
Partner - Creator
Partner - Creator
Author

HI Andrey,


Thank you for your message.  I fear I don't understand what this means?