Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Morning all,
I have the following script which is loading two tables into one:
LOAD Age,
WRKTYPE,
SQL Select *
FROM Age.qvd
Left Join
Load WRKTYPE,
ASL,
SQL Select *
FROM ASL.qvd
Now I need to add a calculated field based on the Age-ASL...how do I do this considering the field doesn't exist within the table until I add it?
Use like this :
Table1:
LOAD Age,
WRKTYPE,
SQL Select *
FROM Age.qvd;
Left Join
Load WRKTYPE,
ASL,
SQL Select *
FROM ASL.qvd;
TableCombined:
Load
Age
,WRKTYPE
,ASL
,if(Age='X' and ASL='Y',1,0) as Numerator
Resident Table1;
DROP Table Table1;
Use like this :
Table1:
LOAD Age,
WRKTYPE,
SQL Select *
FROM Age.qvd;
Left Join
Load WRKTYPE,
ASL,
SQL Select *
FROM ASL.qvd;
TableCombined:
Load
Age
,WRKTYPE
,ASL
,if(Age='X' and ASL='Y',1,0) as Numerator
Resident Table1;
DROP Table Table1;
Try this:
TempTable:
Load WRKTYPE,
Age-ASL AS [Your field]
Resident <Your table name>;
LEFT JOIN <Your table name>
Load *
Resident TempTable;
Drop table TempTable;
Hi,
Try this
DataTemp:
LOAD Age,
WRKTYPE;
SQL Select *
FROM Age.qvd
Left Join
Load WRKTYPE,
ASL;
SQL Select *
FROM ASL.qvd
Data:
LOAD
*,
Age - ASL AS CalculatedValue
RESIDENT DataTemp;
DROP TABLE DataTemp;
Regards,
Jagan.
Temp:
LOAD Age,
WRKTYPE,
SQL Select *
FROM Age.qvd
Left Join
Load WRKTYPE,
ASL,
SQL Select *
FROM ASL.qvd;
Final:
load *
Age-ASL as Calculated
resident Table;
drop table Temp;
hope it helps