cancel
Showing results for 
Search instead for 
Did you mean: 

select the first entire row by a group

KdbNoob
New Contributor

I know I can do something like 

select first price, first volume by date, sym from tab. 

That gives me the first price and first column of each date, sym pair. 

But what if I want to select the first entire row, without having to list all the column names, what should I use? 


2 REPLIES 2

effbiae
New Contributor
my first attempt is:

q)t:([]date:2 2 2 3;sym:`a`a`b`b;vol:10 20 30 40;px:2 1 5 4)
q)select from t where i in value exec first i by date,sym from t
date sym vol px
---------------
2    a   10  2
2    b   30  5
3    b   40  4

ta, jack

There is another thread where this problem has been discussed.
You can find it here.

Regards,
Paul