Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Is it possible, in loading data from SQL, add new field using IF condition.
Ex: IF(DataTo<Today(),'True','False') as NewField
Yes. using preceding load you can do that
LOAD *,
if(ToDate <today(),'True','False') as Flag;
SQL Select ID,FromDate,ToDate
FROM db.tablename;
how should this work?
You are loading a number of lines.
In one Date<today(), in the next line maybe not.
You can't delete a field in a table for a single line (or a number of lines).
You can load all datas < today and next = today() in two diffenrent tables
I want to load all data from table. I just want add new field in line, with some information about one of fields from this line.
If ToDate<Today(), True,False
For ex (Today 01/20/2020):
Id FromDate ToDate NewField
1 01/01/2020 01/19/2020 'True'
2 01/01/2020 01/25/2020 'False'
Yes. using preceding load you can do that
LOAD *,
if(ToDate <today(),'True','False') as Flag;
SQL Select ID,FromDate,ToDate
FROM db.tablename;
so you give the code by yourself in the first post....
Thank you. Its works.