views:

58

answers:

1

this is a mysql table

num        wt
a          24
e          22
c          11
d          24
b          13
f          12

how can i create a mysql query which will display with descending order of weights and give random sorting to num with same weight . thus the select query can have two valid results

a    24
d    24
e    22 
b    13
f    12
c    11

AND

d    24
a    24
e    22 
b    13
f    12
c    11
+1  A: 

Try using

SELECT *
FROM YourTable
ORDER BY wt DESC, RAND()
astander