Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
Thread: ORDER by random
02-18-2006, 12:23 AM #1
ORDER by random
Is there a way of ordering a selected database randomly?
If so does anyone know the string I would have to use for this?
02-18-2006, 02:08 AM #2
02-18-2006, 10:26 AM #3
I didn't think there would be that kind of clause. I want to select the database and order it in a random order. I will only be displaying the first row on my homepage so that I can display an image which links to a full size version on another page.Originally Posted by vinyl-junkie
02-18-2006, 03:32 PM #4
Will you be displaying things in random order or just selecting the first record randomly? If selecting the first record randomly, by an id for example, just come up with a random number generator and select the one record using that random number.
What language are you using to code your page?
02-18-2006, 05:50 PM #5
Im using VBOriginally Posted by vinyl-junkie
I would prefer not to do it that way because I have deleted records, so some IDs are missing.
02-18-2006, 06:07 PM #6
02-20-2006, 08:51 PM #7
- Join Date
- Sep 2004
- Thanked 40 Times in 40 Posts
03-01-2006, 04:39 PM #8
I may be wrong but wouldn't this just be selecting a random number between certain values. So if I had deleted a record with ID of 8, then if 8 was randomly selected nothing would appear
12-05-2006, 06:11 PM #9
- Join Date
- Dec 2006
- Thanked 0 Times in 0 Posts
Selecting a random record from an Access databse
I'm assuming your using coldfusion. So if you are, his might be usefull:
<!---first set the query --->
<cfquery name="rs" datasource="#dsn#">
<!--- then use the output to display randomly --->
<cfset displayRow = randRange(1,rs.recordcount)>
<cfoutput query="rs" startrow="#displayRow#" maxrows="1">
-- show the random record
Hope this helps.