[thelist] Custom sorting/ordering of query results

Matt Warden mwarden at gmail.com
Tue Aug 23 09:51:46 CDT 2005


> I can't see there being any reason for truly random sorting, so surely
> you need to find out what the rules are he's actually asking for?

It's not random, surely. But often there is not a real reason that
things should be ordered as they are, other than the desire to have
them ordered. For example, the order of front-page stories might have
nothing to do with date or any other existing data. You could add a
"priority" field or something like that, but really you are just
adding a nice name to a sort order field.

Another reason might be that you cannot predict the ordering rules. If
I'm building an application that I am going to sell to customers, I
may not want to rely on my abilities to predict what my customers'
sort rules would be. So, it might just be a flexibility issue.

> In situations where really random sort order is required, I use a
> sortOrder field and display sorted on that, but it doesn't sound like
> that is what is being asked for here...

That's basically what he's doing with FIND_IN_SET, except the
sort_order field is an argument to FIND_IN_SET rather than an
attribute to the relation.

-- 
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.


More information about the thelist mailing list