On Sat, Dec 13, 2008 at 10:26 PM, Jim McAtee <jmca...@mediaodyssey.com>wrote:
> > The max price may not be present and is set to zero when that's the case, > so data might look like: > > 1 5 > 5 0 > 3 10 > 8 0 > 6 0 > > I want to order by the larger of the two column values > > ORDER BY Max(minprice, maxprice) DESC > > But SQL's MAX() can't be used like this since it's an aggregate function. > Is there a MySQL function that would do this? > I may be misunderstanding what you expect the result to be but ORDER BY minprice desc, maxprice desc would return rows in descending order of minprice and if there were multiples of minprice, they would be ordered in descending order of maxprice. With your example date, this should be: 8 0 6 0 5 0 3 10 1 5 Stephen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316745 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4