<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.smt-x.com/index.php?action=history&amp;feed=atom&amp;title=Transpose_in_database_queries</id>
	<title>Transpose in database queries - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.smt-x.com/index.php?action=history&amp;feed=atom&amp;title=Transpose_in_database_queries"/>
	<link rel="alternate" type="text/html" href="https://wiki.smt-x.com/index.php?title=Transpose_in_database_queries&amp;action=history"/>
	<updated>2026-04-03T23:09:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.3</generator>
	<entry>
		<id>https://wiki.smt-x.com/index.php?title=Transpose_in_database_queries&amp;diff=982&amp;oldid=prev</id>
		<title>Smtxwiki: Smtxwiki moved page Transpose to Transpose in database queries</title>
		<link rel="alternate" type="text/html" href="https://wiki.smt-x.com/index.php?title=Transpose_in_database_queries&amp;diff=982&amp;oldid=prev"/>
		<updated>2025-01-17T10:24:12Z</updated>

		<summary type="html">&lt;p&gt;Smtxwiki moved page &lt;a href=&quot;/index.php/Transpose&quot; class=&quot;mw-redirect&quot; title=&quot;Transpose&quot;&gt;Transpose&lt;/a&gt; to &lt;a href=&quot;/index.php/Transpose_in_database_queries&quot; title=&quot;Transpose in database queries&quot;&gt;Transpose in database queries&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:24, 17 January 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Smtxwiki</name></author>
	</entry>
	<entry>
		<id>https://wiki.smt-x.com/index.php?title=Transpose_in_database_queries&amp;diff=253&amp;oldid=prev</id>
		<title>Smtxwiki: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.smt-x.com/index.php?title=Transpose_in_database_queries&amp;diff=253&amp;oldid=prev"/>
		<updated>2020-05-25T20:44:31Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:44, 25 May 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Smtxwiki</name></author>
	</entry>
	<entry>
		<id>https://wiki.smt-x.com/index.php?title=Transpose_in_database_queries&amp;diff=252&amp;oldid=prev</id>
		<title>Smtxwiki: Created page with &quot;Sometime you want to transpose data from rows into columns. For example, the person_extra table contains values that belong to persons, but the data is stored as rows. Here&#039;s...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.smt-x.com/index.php?title=Transpose_in_database_queries&amp;diff=252&amp;oldid=prev"/>
		<updated>2016-12-19T09:36:36Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Sometime you want to transpose data from rows into columns. For example, the person_extra table contains values that belong to persons, but the data is stored as rows. Here&amp;#039;s...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Sometime you want to transpose data from rows into columns. For example, the person_extra table contains values that belong to persons, but the data is stored as rows. Here&amp;#039;s a query to get the desired result:&lt;br /&gt;
&lt;br /&gt;
  select &lt;br /&gt;
   person_id, &lt;br /&gt;
   MAX( CASE fieldname WHEN &amp;#039;Person_fieldname1&amp;#039; THEN fieldvalue END) as Field1name, &lt;br /&gt;
   MAX( CASE fieldname WHEN &amp;#039;Person_fieldname2&amp;#039; THEN fieldvalue END) as Field2name, &lt;br /&gt;
   email &lt;br /&gt;
  from personextra &lt;br /&gt;
   inner join person on person.id=personextra.person_id &lt;br /&gt;
  where (fieldname = &amp;#039;Person_fieldname1&amp;#039; or fieldname = &amp;#039;Person_fieldname1&amp;#039;) and person.isactive=1 and fieldvalue &amp;lt;&amp;gt; &amp;#039;&amp;#039; &lt;br /&gt;
  group by person_id, email&lt;/div&gt;</summary>
		<author><name>Smtxwiki</name></author>
	</entry>
</feed>