<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Finding the smallest or largest value across multiple columns in MySQL</title>
	<atom:link href="http://dancingpenguinsoflight.com/2009/03/finding-the-smallest-or-largest-value-across-multiple-columns-in-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://dancingpenguinsoflight.com/2009/03/finding-the-smallest-or-largest-value-across-multiple-columns-in-mysql/</link>
	<description></description>
	<lastBuildDate>Thu, 09 Feb 2012 14:28:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Charan Singh</title>
		<link>http://dancingpenguinsoflight.com/2009/03/finding-the-smallest-or-largest-value-across-multiple-columns-in-mysql/comment-page-1/#comment-68898</link>
		<dc:creator>Charan Singh</dc:creator>
		<pubDate>Tue, 31 Jan 2012 15:15:07 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=716#comment-68898</guid>
		<description>Hello !
I&#039;m trying to compare 5 columns for the highest and lowest values in these with some cells/rows as null value; Following above example when I am trying to run the query it doesn&#039;t bring least value in the  &quot;Resultvalue&quot; column, it brings NULL cell/row with no Value in these, where ever there is null in the col1 to col5 and only brings the least correct value results if no col is null/ where null doesnt get substituted with 999 value as per this query. Please guide

Use Db;
Create table Test  As 
SELECT *,
least(ifnull(col1,&#039;999&#039;),
ifnull(col2, &#039;999&#039;),
ifnull(col3, &#039;999&#039;),
ifnull(col4, &#039;999&#039;),
ifnull(col5, &#039;999&#039;)
) AS Resultvalue,
From table Db.Test
Group by Id;</description>
		<content:encoded><![CDATA[<p>Hello !<br />
I&#8217;m trying to compare 5 columns for the highest and lowest values in these with some cells/rows as null value; Following above example when I am trying to run the query it doesn&#8217;t bring least value in the  &#8220;Resultvalue&#8221; column, it brings NULL cell/row with no Value in these, where ever there is null in the col1 to col5 and only brings the least correct value results if no col is null/ where null doesnt get substituted with 999 value as per this query. Please guide</p>
<p>Use Db;<br />
Create table Test  As<br />
SELECT *,<br />
least(ifnull(col1,&#8217;999&#8242;),<br />
ifnull(col2, &#8217;999&#8242;),<br />
ifnull(col3, &#8217;999&#8242;),<br />
ifnull(col4, &#8217;999&#8242;),<br />
ifnull(col5, &#8217;999&#8242;)<br />
) AS Resultvalue,<br />
From table Db.Test<br />
Group by Id;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Atea</title>
		<link>http://dancingpenguinsoflight.com/2009/03/finding-the-smallest-or-largest-value-across-multiple-columns-in-mysql/comment-page-1/#comment-14933</link>
		<dc:creator>Atea</dc:creator>
		<pubDate>Mon, 05 Apr 2010 17:12:21 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=716#comment-14933</guid>
		<description>Thanks! I was looking for hours for this!

My solution for two columns with decimals:

SELECT LEAST(price_month_regular, ifnull(price_month_action, 9999)) AS least FROM `cp_contracts` ORDER BY least</description>
		<content:encoded><![CDATA[<p>Thanks! I was looking for hours for this!</p>
<p>My solution for two columns with decimals:</p>
<p>SELECT LEAST(price_month_regular, ifnull(price_month_action, 9999)) AS least FROM `cp_contracts` ORDER BY least</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Don McArthur</title>
		<link>http://dancingpenguinsoflight.com/2009/03/finding-the-smallest-or-largest-value-across-multiple-columns-in-mysql/comment-page-1/#comment-1055</link>
		<dc:creator>Don McArthur</dc:creator>
		<pubDate>Sat, 21 Mar 2009 13:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=716#comment-1055</guid>
		<description>Most implementations of SQL don&#039;t allow the mixing of grouped and ungrouped columns in the SELECT clause. MySQL does, but the row selected for display from the ungrouped column is essentially randomly chosen. The groupwise max solution is a means of overcoming this.

http://jan.kneschke.de/projects/mysql/groupwise-max/</description>
		<content:encoded><![CDATA[<p>Most implementations of SQL don&#8217;t allow the mixing of grouped and ungrouped columns in the SELECT clause. MySQL does, but the row selected for display from the ungrouped column is essentially randomly chosen. The groupwise max solution is a means of overcoming this.</p>
<p><a href="http://jan.kneschke.de/projects/mysql/groupwise-max/" rel="nofollow">http://jan.kneschke.de/projects/mysql/groupwise-max/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

