2 years ago

#38281

test-img

Caz

Talend - how to select rows from a table where the load time is after the date/time in another table

I have a staging table in Snowflake with a load datetimestamp. I also have a separate table with a load datetimestamp that i need to reference back to the staging table. I only want to select the data from the staging table where the datetime is after the last table load in my second table - so only new entries.

I can get the max date from my second table but I don't know which option to use to restrict the data retrieved from the staging table. I don't have a specific primary key to join back on - it is a combination of a large number of fields so i'd rather not try to join them together if I can help it.

I've set a Global Variable which works okay and now want to use it in my Query but it doesn't seem to work so i'm wondering if i'm using it correctly? My query is as follows: "SELECT TOP 20 * FROM RAW_SALES_GK WHERE to_varchar(LOADDATETIME_GK, 'dd-mon-yyyy hh:mi:ss') > '"+globalMap.get("GKLastLoadDate")+"'"

I attempted to put quotes around the date as it errors without it. Although I am now getting data back it isn't following the rules of my query.

enter image description here

talend

0 Answers

Your Answer

Accepted video resources