<?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: Unwalking a string with GROUP_CONCAT</title>
	<atom:link href="http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat/feed" rel="self" type="application/rss+xml" />
	<link>http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat</link>
	<description>Blog by Shlomi Noach</description>
	<lastBuildDate>Fri, 12 Mar 2010 04:19:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Checking for string permutation &#124; code.openark.org</title>
		<link>http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat/comment-page-1#comment-10973</link>
		<dc:creator>Checking for string permutation &#124; code.openark.org</dc:creator>
		<pubDate>Wed, 24 Feb 2010 21:50:08 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=840#comment-10973</guid>
		<description>[...] to business: how do we normalize a text using SQL? Well, once again, string walking and string unwalking to the rescue. The trick is to break the string apart (to distinct characters), then re-combine the [...]</description>
		<content:encoded><![CDATA[<p>[...] to business: how do we normalize a text using SQL? Well, once again, string walking and string unwalking to the rescue. The trick is to break the string apart (to distinct characters), then re-combine the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rotating SQL graphs horizontally &#124; code.openark.org</title>
		<link>http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat/comment-page-1#comment-2781</link>
		<dc:creator>Rotating SQL graphs horizontally &#124; code.openark.org</dc:creator>
		<pubDate>Thu, 23 Jul 2009 13:11:17 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=840#comment-2781</guid>
		<description>[...] Unwalking a string with GROUP_CONCAT [...]</description>
		<content:encoded><![CDATA[<p>[...] Unwalking a string with GROUP_CONCAT [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shantanu Oak</title>
		<link>http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat/comment-page-1#comment-2654</link>
		<dc:creator>Shantanu Oak</dc:creator>
		<pubDate>Tue, 14 Jul 2009 14:15:18 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=840#comment-2654</guid>
		<description>Yes, I got exactly the same warning and after following your tip, I got the results. Thanks.</description>
		<content:encoded><![CDATA[<p>Yes, I got exactly the same warning and after following your tip, I got the results. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland Bouman</title>
		<link>http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat/comment-page-1#comment-2651</link>
		<dc:creator>Roland Bouman</dc:creator>
		<pubDate>Tue, 14 Jul 2009 11:30:37 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=840#comment-2651</guid>
		<description>Hi Shantanu, 

do you get any warnings? If group_concat_max_len really is too short to hold the result, you should get a warning:

1 row in set, 1 warning (0.00 sec)

mysql&gt; show warnings;
+---------+------+--------------------------------------+
&#124; Level   &#124; Code &#124; Message                              &#124;
+---------+------+--------------------------------------+
&#124; Warning &#124; 1260 &#124; 1 line(s) were cut by GROUP_CONCAT() &#124;
+---------+------+--------------------------------------+

If you want to be sure, don&#039;t set group_concat_max_len to a particular length, just set it to max_allowed_packet. This is the practical maximum of any string length and if you exceed that you will get an entirely different error message, see: http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html</description>
		<content:encoded><![CDATA[<p>Hi Shantanu, </p>
<p>do you get any warnings? If group_concat_max_len really is too short to hold the result, you should get a warning:</p>
<p>1 row in set, 1 warning (0.00 sec)</p>
<p>mysql&gt; show warnings;<br />
+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| Level   | Code | Message                              |<br />
+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| Warning | 1260 | 1 line(s) were cut by GROUP_CONCAT() |<br />
+&#8212;&#8212;&#8212;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+</p>
<p>If you want to be sure, don&#8217;t set group_concat_max_len to a particular length, just set it to max_allowed_packet. This is the practical maximum of any string length and if you exceed that you will get an entirely different error message, see: <a href="http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shantanu Oak</title>
		<link>http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat/comment-page-1#comment-2649</link>
		<dc:creator>Shantanu Oak</dc:creator>
		<pubDate>Tue, 14 Jul 2009 08:12:16 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=840#comment-2649</guid>
		<description>I forgot to mention one thing about group_concat. I am getting 54 strings as against expected 74 when I use group_concat. I do not have access to my.cnf file so I changed the session variable but it did not help.
SET SESSION group_concat_max_len = 1000000;</description>
		<content:encoded><![CDATA[<p>I forgot to mention one thing about group_concat. I am getting 54 strings as against expected 74 when I use group_concat. I do not have access to my.cnf file so I changed the session variable but it did not help.<br />
SET SESSION group_concat_max_len = 1000000;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shantanu Oak</title>
		<link>http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat/comment-page-1#comment-2647</link>
		<dc:creator>Shantanu Oak</dc:creator>
		<pubDate>Tue, 14 Jul 2009 06:08:29 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=840#comment-2647</guid>
		<description>I was just thinking of writing a SP.
Thanks a lot for sharing this.
I selected the int_col because I wanted the exact position of the character.</description>
		<content:encoded><![CDATA[<p>I was just thinking of writing a SP.<br />
Thanks a lot for sharing this.<br />
I selected the int_col because I wanted the exact position of the character.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat/comment-page-1#comment-2445</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Wed, 24 Jun 2009 16:59:39 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=840#comment-2445</guid>
		<description>Hi,

Why, with GROUP_CONCAT, of course.
You&#039;ll need to create the icon (created mine with TheGimp),
name it &lt;strong&gt;favicon.ico&lt;/strong&gt; and put it in your theme directory (so one icon per theme)

Edit &lt;strong&gt;header.php&lt;/strong&gt; and add the following inside your &lt;head&gt; tag:
&lt;code&gt;&lt;link rel=&quot;shortcut icon&quot; href=&quot;&lt;?php bloginfo(&#039;template_directory&#039;); ?&gt;/favicon.ico&quot; /&gt;
&lt;/code&gt;
That should do the work</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Why, with GROUP_CONCAT, of course.<br />
You&#8217;ll need to create the icon (created mine with TheGimp),<br />
name it <strong>favicon.ico</strong> and put it in your theme directory (so one icon per theme)</p>
<p>Edit <strong>header.php</strong> and add the following inside your &lt;head&gt; tag:<br />
<code>&lt;link rel="shortcut icon" href="&lt;?php bloginfo('template_directory'); ?&gt;/favicon.ico" /&gt;<br />
</code><br />
That should do the work</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RT</title>
		<link>http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat/comment-page-1#comment-2443</link>
		<dc:creator>RT</dc:creator>
		<pubDate>Wed, 24 Jun 2009 14:46:42 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=840#comment-2443</guid>
		<description>Hi Shlomi, 
Can you please tell how you added that favicon to your blog...

RT.</description>
		<content:encoded><![CDATA[<p>Hi Shlomi,<br />
Can you please tell how you added that favicon to your blog&#8230;</p>
<p>RT.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland Bouman</title>
		<link>http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat/comment-page-1#comment-2390</link>
		<dc:creator>Roland Bouman</dc:creator>
		<pubDate>Thu, 18 Jun 2009 07:26:04 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=840#comment-2390</guid>
		<description>Hi Shlomi,

Perhaps it was me that wasn&#039;t clear. 

In your original post, you mentioned that it was interesting that GROUP_CONCAT does not require a GROUP BY clause. I just pointed out that none of the aggregate functions require a GROUP BY clause, so GROUP_CONCAT is not different from the other aggregate functions in that respect. 

I do agree that applying only GROUP BY is aggregation. This brings us to the WTF:

SQL provides two completely different constructs that cause aggregation (as in grouping of rows): 
- a GROUP BY clause
- aggregate function

So I&#039;m just saying that IMO, it is strange that the presence of an aggregate function causes aggregation. It would make more sense to me if a grouping construct would first be required before you would be allowed to apply aggregate functions. So in my mind, it would make more sense to write this:

SELECT COUNT(*)
FROM t
GROUP BY NULL

instead of this

SELECT COUNT(*)
FROM t

(of course , GROUP BY NULL is strange, that&#039;s because the keywords were designed to always group according to an expression. That could be solved by making the [BY exprlist] part optional, in which case you would have to write GROUP to convey that you want all rows to be grouped into one row.)

HTH, 

Roland</description>
		<content:encoded><![CDATA[<p>Hi Shlomi,</p>
<p>Perhaps it was me that wasn&#8217;t clear. </p>
<p>In your original post, you mentioned that it was interesting that GROUP_CONCAT does not require a GROUP BY clause. I just pointed out that none of the aggregate functions require a GROUP BY clause, so GROUP_CONCAT is not different from the other aggregate functions in that respect. </p>
<p>I do agree that applying only GROUP BY is aggregation. This brings us to the WTF:</p>
<p>SQL provides two completely different constructs that cause aggregation (as in grouping of rows):<br />
- a GROUP BY clause<br />
- aggregate function</p>
<p>So I&#8217;m just saying that IMO, it is strange that the presence of an aggregate function causes aggregation. It would make more sense to me if a grouping construct would first be required before you would be allowed to apply aggregate functions. So in my mind, it would make more sense to write this:</p>
<p>SELECT COUNT(*)<br />
FROM t<br />
GROUP BY NULL</p>
<p>instead of this</p>
<p>SELECT COUNT(*)<br />
FROM t</p>
<p>(of course , GROUP BY NULL is strange, that&#8217;s because the keywords were designed to always group according to an expression. That could be solved by making the [BY exprlist] part optional, in which case you would have to write GROUP to convey that you want all rows to be grouped into one row.)</p>
<p>HTH, </p>
<p>Roland</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://code.openark.org/blog/mysql/unwalking-a-string-with-group_concat/comment-page-1#comment-2389</link>
		<dc:creator>shlomi</dc:creator>
		<pubDate>Thu, 18 Jun 2009 06:36:54 +0000</pubDate>
		<guid isPermaLink="false">http://code.openark.org/blog/?p=840#comment-2389</guid>
		<description>Hi Roland!

Perhaps it&#039;s a matter of semantics, but I&#039;m not sure I understand what you mean.
If I only GROUP BY, is that not considered an aggregation?
For example, in MySQL I can SELECT a non-grouped column with a GROUP BY clause. The selected value is arbitrary, as far as I&#039;m concerned, but can&#039;t it be said that it&#039;s aggregated?

In math we would call this value a &#039;representer&#039; of the group (I&#039;m bending some rules here).</description>
		<content:encoded><![CDATA[<p>Hi Roland!</p>
<p>Perhaps it&#8217;s a matter of semantics, but I&#8217;m not sure I understand what you mean.<br />
If I only GROUP BY, is that not considered an aggregation?<br />
For example, in MySQL I can SELECT a non-grouped column with a GROUP BY clause. The selected value is arbitrary, as far as I&#8217;m concerned, but can&#8217;t it be said that it&#8217;s aggregated?</p>
<p>In math we would call this value a &#8216;representer&#8217; of the group (I&#8217;m bending some rules here).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
