Hi

What would be the best way to select a random row from a result set?

Possibilities:

1) o get the total number of rows using count()
   o generate a random number between 1 and the total
   o select the n'th row using OFFSET

2) o get the total number of rows using count()
   o generate a random number between 1 and the total
   o fetch n times

Option 1 uses 'OFFSET' which is a database-specific keyword, which is
probably bad. 

Also, is there a way to randomize the order of a result set?

Thanks in advance

Jelle Ouwerkerk
Software Developer 
Openface Internet Inc.
Montreal, Quebec, Canada
http://www.openface.ca


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to