php, mysql How to do a random selection and limit response?
| From: | Leonard B Burton | Date: | Wed, 24 Mar 2004 20:52:08 +0000 |
| Subject: | php, mysql How to do a random selection and limit response? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-181391@lists.php.net to get a copy of this message | ||
greetings,
I would like to do a random selection in mysql [select * from members order by rand() limit $limit]
and then I'd like to insert the items selected into a table [named already_selected] with a
datetime stamp to make sure one item is only sleceted once over a defined period of time.
Would it be best to do the select and then an insert? Would it be best to do a left join in The
select statement?
Can anyone suggest a more efficient way?
Thanks,
Leonard Burton