# select the first entire row by a group

**URL:** <https://forum.kx.com/t/select-the-first-entire-row-by-a-group/10929>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [April 2, 2016, 2:50am UTC](https://forum.kx.com/t/select-the-first-entire-row-by-a-group/10929 "2016-04-02T02:50:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KdbNoob](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@KdbNoob](https://forum.kx.com/u/KdbNoob)\
**Post date:** [April 2, 2016, 2:50am UTC](https://forum.kx.com/t/select-the-first-entire-row-by-a-group/10929/1 "2016-04-02T02:50:00Z")

</div>

I know I can do something like&nbsp;

select first price, first volume by date, sym from tab.&nbsp;

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

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

---

<div class="post-metadata">

**Author:** ![effbiae](https://avatars.discourse-cdn.com/v4/letter/e/ecae2f/32.png) [@effbiae](https://forum.kx.com/u/effbiae)\
**Post date:** [April 2, 2016, 8:44am UTC](https://forum.kx.com/t/select-the-first-entire-row-by-a-group/10929/2 "2016-04-02T08:44:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pauljloughran](https://avatars.discourse-cdn.com/v4/letter/p/9e8a1a/32.png) [@pauljloughran](https://forum.kx.com/u/pauljloughran)\
**Post date:** [April 2, 2016, 8:50am UTC](https://forum.kx.com/t/select-the-first-entire-row-by-a-group/10929/3 "2016-04-02T08:50:00Z")

</div>

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

Regards,

Paul
