Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I got problem,
That is, how can i choose the latest date from the source.
The File structure will be like that.
Item | Date | Price |
A | 1/5/2010 | 12 |
A | 3/5/2010 | 15 |
A | 6/5/2010 | 16 |
B | 1/5/2010 | 1 |
B | 5/5/2010 | 3 |
I want to extract the record is Only Item A (6/5/2010) and Item B (5/5/2010)
Thanks and Best Regards,
kzorrw
Hi,
you can use the following code
tab1:
LOAD * INLINE [
Item, Date, Price
A, 1/5/2010, 12
A, 3/5/2010, 15
A, 6/5/2010, 16
B, 1/5/2010, 1
B, 5/5/2010, 3
];
load Item,max(Date) as maximum resident tab1 group by Item;
it should work fine
thanks
Hi,
you can use the following code
tab1:
LOAD * INLINE [
Item, Date, Price
A, 1/5/2010, 12
A, 3/5/2010, 15
A, 6/5/2010, 16
B, 1/5/2010, 1
B, 5/5/2010, 3
];
load Item,max(Date) as maximum resident tab1 group by Item;
it should work fine
thanks
tab1:
LOAD * INLINE [
Item, Date, Price
A, 1/5/2010, 12
A, 3/5/2010, 15
A, 6/5/2010, 16
B, 1/5/2010, 1
B, 5/5/2010, 3
];
inner keep load Item,max(Date) as Date resident tab1 group by Item;
this way you will only get the latest record per each item.