On Mon, Feb 13, 2006 at 04:35:30PM +0100, Mario Splivalo wrote: > Am I misusing the ORDER BY with CASE, or, what? :) > > I have a table, messages, half dozen of columns, exposing here just > three of them: > > pulitzer2=# select id, "from", receiving_time from messages where > service_id = 20 order by case when 5=5 then 2 else 3 end desc limit 5;
I'm not sure what you are trying to do here, but it seems that an order by statement should at least contain something that is part of the resultrow. "case when 5=5 then 2 else 3 end desc limit 5" does not contain any column to sort on. So I think it will evaluate to some constant value and not sorting is really done -- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen [EMAIL PROTECTED] http://www.xs4all.nl/~reinoud __________________________________________________ ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings