Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: random records Post Reply Post New Topic
Author Message
sanchezgmc06
Senior Member
Senior Member
Avatar

Joined: 21 Jan 2011
Online Status: Offline
Posts: 107
Quote sanchezgmc06 Replybullet Topic: random records
    Posted: 10 Mar 2022 at 12:31pm
Hello

Is there a way to select 20 random records from a table?

Using SQL querey

Edited by sanchezgmc06 - 10 Mar 2022 at 12:32pm
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 14 Mar 2022 at 4:18am
I have seen code where 'random' records could be pulled from the data. But it has been a long time and I would have to do some research (on the internet) to see if I could find the code again.  Also I am not sure if is truly random or just sampling the data.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 14 Mar 2022 at 5:38am
You can use Rand()...You should seed it with a value that changes every record. You will need to manipulate a little.

I cannot seem to post a snippet, you will have to Google it.

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.