Load data from database in cycle with parametr in SQL part
I am pretty new in using QS and need for your help!
I need to load data from clickhouse by partitions without using qvd files. For better understanding let me show you the current way:
Load appear_date, uid;
SQL SELECT uid, min(event_datetime) as appear_datetime from database and event_date > '2019-03-31' and event_date < '2019-07-01' GROUP BY uid;
Load appear_date, uid where not exists(uid);
SQL SELECT uid, min(event_datetime) as appear_datetime from database and event_date > '2019-07-01' and event_date < '2019-11-01' GROUP BY uid
So, i load uids with min date for period '2019-03-31' - < '2019-07-01' and in second part i load uids with min date for the period shifted for 3 months, but only those uids that not exist in the first load.
How can i do the same in cycle? Meaning that i should shift dates for 3 months inside the SQL-statement and check if uids don't exist in previous loads?