Hello, Antonio Fiol Bonnin!
On Fri, Dec 21, 2001 at 06:41:41PM +0100, you wrote:
> XXX is a random value ranking from 0 (or 1) to the maximum id value. You
> generate it outside the database.
Maximum id is not good solution, beacuse some of ids between 0 (or 1)
could be missing for some reasons. You should:
select id from table;
Then chose random one outside SQL, and then:
select * from table where table.id = '$random_id';
This would be slower but will work for sure.
Another approach -- select random id outside SQL from 0 (or 1) to
maximum_id and then trying to select with 'where table.id =
'$random_id'' until you've got > 0 rows in result.
--
NEVE-RIPE