# Selecting randomly with SQL

**URL:** <https://forum.kirupa.com/t/selecting-randomly-with-sql/250448>\
**Category:** Uncategorized\
**Created:** [January 29, 2008, 6:16pm UTC](https://forum.kirupa.com/t/selecting-randomly-with-sql/250448 "2008-01-29T18:16:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RabBell](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rabbell/32/340_2.png) [@RabBell](https://forum.kirupa.com/u/RabBell)\
**Post date:** [January 29, 2008, 6:16pm UTC](https://forum.kirupa.com/t/selecting-randomly-with-sql/250448/1 "2008-01-29T18:16:27Z")

</div>

I’m looking for a bit of SQL code that will select some entries randomly from an SQL table.

For instance I’d like to feed a parameter in that contains the number 20, and the returned record contains 20 randomly and distinct selected records.

Anyone know how this can be done? (never came across randomly select records)

any helps appreciated 🙂
