Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Im trying to fetch ID, Barcode1, Barcode2,Units1, Units2 from Table1 and do the following operation.
But getting the error: "Syntax error in Expression"
Please lemme knw if there is any mistake i'm doing!
Load ID, B1, B2, Sum(U1) as FirstSum, Sum(U2) as SecondSum
Group By SKU#;
Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2
Resident
Table1;
Try this:
Load ID, B1, B2, Sum(U1) as FirstSum, Sum(U2) as SecondSum
Group By ID, B1, B2; // Group by should have all non agreegated fields
Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2
Resident
Table1;
Your aggregation field in the GROUP BY clause is SKU# and no other fields than the aggregation fields may be used outside aggregation functions in the loaded expressions. Hence you'll either need to add ID, B1, B2 to the aggregation fields in the clause or embed these in aggregation functions.
Try this:
Load ID, B1, B2, Sum(U1) as FirstSum, Sum(U2) as SecondSum
Group By ID, B1, B2; // Group by should have all non agreegated fields
Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2
Resident
Table1;
In your script SKU# is not present in the table 1. If you have that in your actual table and you want to group by values over it, then use appropriate aggregation function for ID, B1 and B2 also (If it make sense :-)). Something similar to below
Load
SKU#,
Min(ID) as ID
,Min(B1) as B1
,Min(B2) as B2
,Sum(U1) as FirstSum,
Sum(U2) as SecondSum
Group By SKU#;
Load ID, Barcode1 as B1, Barcode2 as B2, Units1 as U1, Units2 as U2, SKU#
Resident
Table1;
Regards,
KKR
Hi Saravana,
Got it.
thanq very much.
Hi Kranthi,
Sorry for the mistake.
It was Group by ID;