Posted By

mafro on 04/23/07


Tagged

random sorting


Versions (?)

Sort by random character


 / Published in: SQL
 

Sort a result set by a random letter - this example uses the alphabet and a column named 'text'

  1. ORDER BY case when LEFT([text], 1) >= CHAR(65 + 26 * rand()) then 0 else 1 end

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: Davidhref on August 23, 2007

mafro this is good stuff thanks. This is useful for much more than sorting.

You need to login to post a comment.