i like to avoid a functional select if possibleq){[tbl;grp] select from
t where time=(max;time) fby grp#0!t}[t;`a`b`c]time a b c
d---------------------05:50:33.545 1 1 1 109:36:00.090 2 2 2 90Cheers,
Attila

ah, i missed that TerryLynch originally had something quite
similarinterestingly the fastest solution is hand-roll the frequency
collection (ie, count each group)q)l:100000?10000q)\ts:100 {d:distinct
x;d where(x bin d)=x binr d} asc l481 2229056q)\ts...

that is a very interesting ideato expand on TerryLynch's solution by
relaxing the constraint on types we can doa:{x where
differ[x]&differ[first x; next x:asc x]}this works with nested tooq)a (1
2;2 3; 1 2;4 5;0 0; 0 0)2 34 5

<9132980E-6FD7-4274-A5B6-E74933E55B61@gmail.com> To: "[kdb+] [kdb+]"
In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3608.120.23.2.4)another
way which generalizes to other divisors (and probably easier to
understand is){x<>2*x div 2}