/ Published in: SQL
Sort a result set by a random letter - this example uses the alphabet and a column named 'text'
Expand |
Embed | Plain Text
ORDER BY case when LEFT([text], 1) >= CHAR(65 + 26 * rand()) then 0 else 1 end
Comments
Subscribe to comments
You need to login to post a comment.

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