i have a simple mysql database with 5 different types of products. I would like to be able to to select at random one of each type of product. I have tried using:
"select * from table_name order by RAND() group by type"
but just get an error.
i realise i could write 5 select statemnents, but was wondering if there is a *better* way?
thanks
Damian
2:34 pm on Feb 17, 2003 (gmt 0)
I think it's in the order of your statement..try this:
"select * from table_name group by type order by RAND()"
benihana
3:31 pm on Feb 17, 2003 (gmt 0)
thought id tried that but obviously not. fixed now. thanks