# Select Random records

**URL:** <https://community.easymorph.com/t/select-random-records/4822>\
**Category:** General Q&A\
**Created:** [September 19, 2023, 8:47pm UTC](https://community.easymorph.com/t/select-random-records/4822 "2023-09-19T20:47:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![htims05](https://community.easymorph.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@htims05](https://community.easymorph.com/u/htims05)\
**Post date:** [September 19, 2023, 8:47pm UTC](https://community.easymorph.com/t/select-random-records/4822/1 "2023-09-19T20:47:28Z")

</div>

I have built a dataset that has multiple rows for a given column "ID". How can I select a random 5 rows from each unique "ID"?

Basically I'm trying to get just a small sample set of data from each "ID"

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [September 19, 2023, 10:09pm UTC](https://community.easymorph.com/t/select-random-records/4822/2 "2023-09-19T22:09:54Z")

</div>

Calculate a random column using the random() function. Then use the "Keep min/max" action to keep only the 5 max random numbers for each ID.

See the example below:  
[random-in-group.morph](https://community.easymorph.com/uploads/short-url/9MC2FgUiBvsummoaH0O5k7yXVr8.morph) (3.1 KB)

---

<div class="post-metadata">

**Author:** ![htims05](https://community.easymorph.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@htims05](https://community.easymorph.com/u/htims05)\
**Post date:** [September 20, 2023, 11:01am UTC](https://community.easymorph.com/t/select-random-records/4822/3 "2023-09-20T11:01:24Z")

</div>

Of course - thank you. I was way overthinking this.
