Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
GarethPenrose
Contributor
Contributor

Complex Joins/Lookups

I know how to do traditional joins, where you join on two values being equal, but what about if you want to join on the value that is closest to the one you have?

 

I have a function in MySQL which returns me a value from the row with the closest timestamp to the one I provide to it.

 

We are interested in moving some functions into talends logic and I was wondering if it was possible to do this kind of thing?

Labels (3)
12 Replies
Anonymous
Not applicable

Good luck. This is quite fiddly, but once you have figured this out, it is a very useful technique to help solve lots of different problems. One thing I forgot to mention is that the tMap variables are processed in order (from top to bottom). This logic (if you follow the tutorial) is based around comparing the value of the next tMap variable in the computation of the tmap variable above. This is how you can take a peak back at the last row value. Once the variable above has been set, the variable you were looking back at is updated to be the current row variable ready for the next row's "look back". It is quite tricky to explain (hence the long winded explanation) but really useful and not many people are aware of it.

GarethPenrose
Contributor
Contributor
Author

Thank you for all your help, I think I managed to get this working.

 

Unfortunately, it seems to be slower than doing things directly in the MySQL, so it is not useful to me.

 

That's what this was about, though; an experiment to see what can be done in Talend, so I have what I came for. Thanks again.

Anonymous
Not applicable

Performing logic like this inside a database will always be quicker. If all your data is in the same database and you want performance to be optimal, I would always advocate carrying out logic like this in the database. Otherwise you will incur the latency of retrieving the data from the database, network performance, then processing the data in memory in Java. I assumed that the data was coming from different sources when I answered this. It was also an interesting problem to look at 🙂