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?