Results 1 to 7 of 7

Thread: Take out a random record. [Resolved]

Threaded View

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Take out a random record. [Resolved]

    I have to take out 5 records from a MySQL table. First the 3 last one, and then 2 random records. But no one of them can be the same record. With my current skills I can see 2 methods to do it.

    - I can store all the records that I have taken out, then use a while loop and take out a new random one untill I get a new one.

    - I can use NOT LIKE (or what the syntax is again) and list up the first record that I have taken out the first time in the second one, and then the two first in the 3rd one, and the 3 first in the 4th one, and so on.


    I can't see that any of them is a good solution. Maybe the second one is a bit faster, but that is all.

    Is it a better way?
    Last edited by NoteMe; Jun 21st, 2004 at 02:41 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width