Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This is my query:
// DEMO LOAD
ORDER:
Load * Inline [
Customer|Order
101|2013
101|2011
102|2009
103|2015
101|2017
103|2018
] (delimiter is '|');
// THIS DOES NOT WORK
FIRST_ORDER:
Load Customer, Peek(Order,0) As FirstOrder
Resident ORDER;
// WISHED RESULT:
//
// Customer, FirstOrder
// 101, 2011
// 102, 2009
// 103, 2015
--------------------
I expect this result for "FIRST_ORDER" shown in "WISHED RESULT", however have challenge to write the query accordingly.
My Bad I haven't read your column Names correctly
Try
ORDER:
Load * Inline [
Customer|Order
101|2013
101|2011
102|2009
103|2015
101|2017
103|2018
] (delimiter is '|');
First_Order_Map:
Mapping LOAD
Customer,
Min(Order) as FirstOrder
Resident ORDER
Group By Customer;
FIRST_ORDER:
NoConcatenate
Load
Customer,
ApplyMap('First_Order_Map',Customer) as FirstOrder
Resident ORDER;
DROP Table ORDER;
Try this :
ORDER:
Load * Inline [
Customer|Order
101|2013
101|2011
102|2009
103|2015
101|2017
103|2018
] (delimiter is '|');
FIRST_ORDER:
NoConcatenate
Load
Customer,
Min(Order) As FirstOrder
Resident ORDER
Group by Customer;
DROP Table ORDER;