Hi there,

I would like to do something very similar to a nested foreach with using
order by and then limit. But I would like to limit on a relation to the
total number of records.

users = load 'users' as (userid:chararray, money:long, region:chararray);
grouped_region = group users by region;
top_10_percent = foreach grouped_region {
            sorted = order users by money desc;
            top    = limit sorted $UKNOWN_HOWTO_SET; -- e.g. for the top
10% it would be total users/10 in that region.
            generate group, flatten(top);
};

Thanks a lot for any help on this.

Cheers,
-Marco

Reply via email to