<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SQL UNION query in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883402#M654809</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help.. It'll be useful for me in future&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 04 Jul 2015 18:37:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-07-04T18:37:38Z</dc:date>
    <item>
      <title>SQL UNION query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883395#M654802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good day!&lt;/P&gt;&lt;P&gt;In sql data base i have view (Delivery_points_LastActualTeams) with such values&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="631"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="82"&gt;Point_id&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="101"&gt;Type1&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="131"&gt;Type1Name&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Type2&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="87"&gt;Type2Name&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;Type3&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="102"&gt;Type3Name&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl66" height="20" style="border-top: none;"&gt;23&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Name1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Name3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl66" height="20" style="border-top: none;"&gt;45&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Name2&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Name3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl66" height="20" style="border-top: none;"&gt;32&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Name3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl66" height="20" style="border-top: none;"&gt;56&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Name1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Name2&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some of &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Point_id have more than one field (Type1 or Type2 or Type3) with value 1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I need write sql query which will get me such table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 334px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" width="82"&gt;&lt;STRONG&gt;Point_id&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" style="border-left: none;" width="121"&gt;&lt;STRONG&gt;Type(New Field)&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" style="border-left: none;" width="131"&gt;&lt;STRONG&gt;Name(New Field)&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20" style="border-top-style: none; text-align: center;"&gt;23&lt;/TD&gt;&lt;TD class="xl65" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Type1&lt;/TD&gt;&lt;TD class="xl66" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Name1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20" style="border-top-style: none; text-align: center;"&gt;23&lt;/TD&gt;&lt;TD class="xl65" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Type3&lt;/TD&gt;&lt;TD class="xl66" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Name3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20" style="text-align: center;"&gt;45&lt;/TD&gt;&lt;TD class="xl65" style="border-top-style: none; text-align: center;"&gt;Type2&lt;/TD&gt;&lt;TD class="xl66" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Name2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20" style="text-align: center;"&gt;45&lt;/TD&gt;&lt;TD class="xl65" style="border-top-style: none; text-align: center;"&gt;Type3&lt;/TD&gt;&lt;TD class="xl66" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Name3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20" style="text-align: center;"&gt;32&lt;/TD&gt;&lt;TD class="xl65" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Type3&lt;/TD&gt;&lt;TD class="xl66" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Name3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20" style="border-top-style: none; text-align: center;"&gt;56&lt;/TD&gt;&lt;TD class="xl65" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Type1&lt;/TD&gt;&lt;TD class="xl66" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Name1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20" style="border-top-style: none; text-align: center;"&gt;56&lt;/TD&gt;&lt;TD class="xl65" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Type2&lt;/TD&gt;&lt;TD class="xl66" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;Name2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jul 2015 12:37:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883395#M654802</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-04T12:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: SQL UNION query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883396#M654803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe like this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14360140236143079 jive_text_macro" jivemacro_uid="_14360140236143079" modifiedtitle="true"&gt;
&lt;P&gt;INPUT:&lt;/P&gt;
&lt;P&gt;LOAD Point_id,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type1,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type1Name,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type2,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type2Name,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type3,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type3Name&lt;/P&gt;
&lt;P&gt;FROM&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2061" data-containertype="14" data-objectid="171219" data-objecttype="1" href="https://community.qlik.com/thread/171219"&gt;https://community.qlik.com/thread/171219&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LOAD Point_id, 'Type1' as Type,Type1Name as Name&lt;/P&gt;
&lt;P&gt;RESIDENT INPUT&lt;/P&gt;
&lt;P&gt;WHERE Type1;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LOAD Point_id, 'Type2' as Type,Type2Name as Name&lt;/P&gt;
&lt;P&gt;RESIDENT INPUT&lt;/P&gt;
&lt;P&gt;WHERE Type2;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LOAD Point_id, 'Type3' as Type,Type3Name as Name&lt;/P&gt;
&lt;P&gt;RESIDENT INPUT&lt;/P&gt;
&lt;P&gt;WHERE Type3;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DROP TABLE INPUT;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jul 2015 12:47:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883396#M654803</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-07-04T12:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: SQL UNION query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883397#M654804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are looking for a SQL Query or do you want to do this in QlikView's script?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jul 2015 12:48:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883397#M654804</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-07-04T12:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: SQL UNION query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883398#M654805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It'll be better to do in &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;QlikView's script&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jul 2015 12:49:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883398#M654805</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-04T12:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: SQL UNION query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883399#M654806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/15823"&gt;swuehl&lt;/A&gt;‌ gave you the QlikView solution. That should work for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jul 2015 12:51:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883399#M654806</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-07-04T12:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: SQL UNION query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883400#M654807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it is)&lt;/P&gt;&lt;P&gt;Thanks)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jul 2015 13:10:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883400#M654807</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-04T13:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: SQL UNION query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883401#M654808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know this question has been already answered, but the SQL code will look like the below:&lt;/P&gt;&lt;P&gt;Here is your dataset in SQL:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/91858_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the lengthy SQL code which will give the desired dataset:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/91883_Capture.PNG" style="height: 473px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your Enterprise Data Warehouse (EDW) team keep adding more columns such as "Type4Name", "Type5Name", "Type4", or "Type5", in the SQL end, all you need to do is adding the column name that needs to be unpivotted. Once you bring this data model, the data will flow through your QlikView script.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jul 2015 18:33:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883401#M654808</guid>
      <dc:creator>sinanozdemir</dc:creator>
      <dc:date>2015-07-04T18:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: SQL UNION query</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883402#M654809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help.. It'll be useful for me in future&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Jul 2015 18:37:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-UNION-query/m-p/883402#M654809</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-04T18:37:38Z</dc:date>
    </item>
  </channel>
</rss>

