twomt
12-30-2006, 03:27 PM
Hello,
I am not sure how to do the following task:
I want to order by a certain collumns, but if there are rows that contain the same value in the collumn that I do the order by on then I would like to display the results differently everytime I do the query....
For example:
id lvl
1 1
2 2
3 2
Now if I do SELECT * FROM table ORDER by lvl DESC the result will always be:
id lvl
2 2
3 2
1 1
I would like to see the result above change randomly to
id lvl
3 2
2 2
1 1
and perhaps next time the query is executed the result is again
id lvl
2 2
3 2
1 1
Any suggestions (I hope I made it clear enough)?
I have posted this on the MySQL forum as well and with the help of the people there sort of got it to work by ordering on multiple collumns, but this is not 100% what I was looking for. Is there a way to add this random feature using php?
Thanks,
twomt.
I am not sure how to do the following task:
I want to order by a certain collumns, but if there are rows that contain the same value in the collumn that I do the order by on then I would like to display the results differently everytime I do the query....
For example:
id lvl
1 1
2 2
3 2
Now if I do SELECT * FROM table ORDER by lvl DESC the result will always be:
id lvl
2 2
3 2
1 1
I would like to see the result above change randomly to
id lvl
3 2
2 2
1 1
and perhaps next time the query is executed the result is again
id lvl
2 2
3 2
1 1
Any suggestions (I hope I made it clear enough)?
I have posted this on the MySQL forum as well and with the help of the people there sort of got it to work by ordering on multiple collumns, but this is not 100% what I was looking for. Is there a way to add this random feature using php?
Thanks,
twomt.