<?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: Selecting MySQL Rows Into Columns</title>
	<atom:link href="http://ideaharbor.org/notes/technical/selecting-mysql-rows-into-columns/feed" rel="self" type="application/rss+xml" />
	<link>http://ideaharbor.org/notes/technical/selecting-mysql-rows-into-columns?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=selecting-mysql-rows-into-columns</link>
	<description>random notes mostly for myself</description>
	<lastBuildDate>Mon, 23 Apr 2012 19:13:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Chris</title>
		<link>http://ideaharbor.org/notes/technical/selecting-mysql-rows-into-columns/comment-page-1#comment-3636</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Wed, 26 Aug 2009 20:05:05 +0000</pubDate>
		<guid isPermaLink="false">http://ideaharbor.org/notes/?p=94#comment-3636</guid>
		<description>After searching for like 5 hours and playing around I have found a small way to generate it... See the following snippet:


SELECT DISTINCT 
  CONCAT(&#039;,&#039;,build_field_name,&#039; AS &#039;,build_field_name) 
  AS pivotarg 
FROM aspin_build_fields
WHERE build_field_name IS NOT NULL

This generates the select statement fields so i dont see why you cant just wrapper the other sql statement with it.</description>
		<content:encoded><![CDATA[<p>After searching for like 5 hours and playing around I have found a small way to generate it&#8230; See the following snippet:</p>
<p>SELECT DISTINCT<br />
  CONCAT(&#8216;,&#8217;,build_field_name,&#8217; AS &#8216;,build_field_name)<br />
  AS pivotarg<br />
FROM aspin_build_fields<br />
WHERE build_field_name IS NOT NULL</p>
<p>This generates the select statement fields so i dont see why you cant just wrapper the other sql statement with it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hulet</title>
		<link>http://ideaharbor.org/notes/technical/selecting-mysql-rows-into-columns/comment-page-1#comment-1187</link>
		<dc:creator>hulet</dc:creator>
		<pubDate>Sun, 03 May 2009 04:50:05 +0000</pubDate>
		<guid isPermaLink="false">http://ideaharbor.org/notes/?p=94#comment-1187</guid>
		<description>That would be cool if there were... could you give an example?</description>
		<content:encoded><![CDATA[<p>That would be cool if there were&#8230; could you give an example?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Victor De la Rocha</title>
		<link>http://ideaharbor.org/notes/technical/selecting-mysql-rows-into-columns/comment-page-1#comment-1155</link>
		<dc:creator>Victor De la Rocha</dc:creator>
		<pubDate>Thu, 30 Apr 2009 18:33:08 +0000</pubDate>
		<guid isPermaLink="false">http://ideaharbor.org/notes/?p=94#comment-1155</guid>
		<description>Is there any way to do this dynamically?

Instead of this:

...
from (
(select count(s.id) as num, ’screenshots’ as type from screenshots s where s.site_id = 1)
UNION ALL
(select count(v.id) as num, ‘videos’ as type from videos v where v.site_id = 1)
) as foo
...

Do it with the records grouped from a table.</description>
		<content:encoded><![CDATA[<p>Is there any way to do this dynamically?</p>
<p>Instead of this:</p>
<p>&#8230;<br />
from (<br />
(select count(s.id) as num, ’screenshots’ as type from screenshots s where s.site_id = 1)<br />
UNION ALL<br />
(select count(v.id) as num, ‘videos’ as type from videos v where v.site_id = 1)<br />
) as foo<br />
&#8230;</p>
<p>Do it with the records grouped from a table.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

