Hi guys
If I have a query such as the following:
select price, qty, count i by (60000000000j xbar timestamp), mkt, side from tab
That returns a result set such as:
time mkt side price qty
2011.08.24D23:59:00.000000000MKTB 1.04595 1.04605 1.046071000000 2000000 3000000
2011.08.24D23:59:00.000000000MKTS 1.04635 1.04645 1.046552000000 1000000 1000000
…
How can I sweep the result set for the best price and corresponding quantity by time (Noting that price and qty are lists)?
E.g. in the first row, for “B”, the best price is 1.04595 (min) and the corresponding quantity is 1000000 (i.e. the corresponding entry in the quantity list)
For row 2 (“S”) , the best price is 1.04655 and the corresponding quantity entry is 1000000 …
Im struggling to find a way to do this elegantly for both cases without having to sweep through the table multiple times - anyone got a nice way to do this?
Cheers
– R