Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Is it possible to take the output of one SQL query as a parameter for the next query?
e.g. I run query A. Get a single value (a number from query A). Use that value as a parameter for query B.
Many thanks in advance.
if I understood correctly @Edge for example to create MasterCalendar, we use Let varMinDate to peek min value
and we use it to generate rows
Temp:
Load
min(OrderDate) as minDate,
max(OrderDate) as maxDate
Resident Orders;
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;
TempCalendar:
LOAD
$(varMinDate) + Iterno()-1 As Num,
Date($(varMinDate) + IterNo() - 1) as TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);
@Edge in Load you can use for example Let and Set to peek value and use it as variable in other Load
if I understood correctly @Edge for example to create MasterCalendar, we use Let varMinDate to peek min value
and we use it to generate rows
Temp:
Load
min(OrderDate) as minDate,
max(OrderDate) as maxDate
Resident Orders;
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;
TempCalendar:
LOAD
$(varMinDate) + Iterno()-1 As Num,
Date($(varMinDate) + IterNo() - 1) as TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);
Many Thanks @Taoufiq_Zarra . It has worked as expected :).