[ic] Custom sort algo, sort on filtered data, or concatenate two sorted queries?
paul at gishnetwork.com
Fri Jan 29 16:35:29 UTC 2010
> I want to thank everyone who replied. Sorting primarily by the results
> of LIKE and secondarily by the colors column worked like a charm.
> ... order by colors NOT LIKE "red%", colors
> I'm new to SQL and hit on this after the 1st digest after my post, so
> it somehow never occurred to me to see if there was an
> ascending/descending sort order option. So what would be faster/more
> efficient: NOT LIKE or DESC? (I suppose it could very well vary with
> the implementation of SQL.)
> In any case, it lets me have, in this example, everything with red in
> the colors listed, with those starting with red first. Just what the
> doctor ordered. Fortunately, we have no color names that start with
> other color names, so we don't have that scenario to deal with.
> The next stage is making a page with the list of colors and links to
> their various page #s from their more lists. I'll poke around at it
> and give you guys a holler if I get stuck. (I've already decided I
> want to have some other data stored for each color - descriptions etc.
> - so I'll be creating a table that will help things.)
I'll throw this in as well - if you follow my original "solution" you'd have
the added ability to differentiate the "better" results on the page - for
example "These results matched most closely..." and "Here are other results
that relate to your criteria".
If you don't need that, Peter's solution is simple and fast.
More information about the interchange-users