<?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 queries in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/sql-queries/m-p/1360173#M822516</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aggregation and group by goes together always.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) select empid, ename, sal from emp group by empid;&lt;/P&gt;&lt;P&gt; This statement do not need a group by as there is no aggregation(sum/Max/Count etc) involved &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) select empid, ename, max(sal) from emp group by empid;&lt;/P&gt;&lt;P&gt;This statement is partially correct as group by is missing ename.Basically, group by clause should contain all the non aggregated fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hth&lt;/P&gt;&lt;P&gt;Sasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Aug 2017 17:17:57 GMT</pubDate>
    <dc:creator>sasiparupudi1</dc:creator>
    <dc:date>2017-08-07T17:17:57Z</dc:date>
    <item>
      <title>sql queries</title>
      <link>https://community.qlik.com/t5/QlikView/sql-queries/m-p/1360170#M822513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have 2 queries&lt;/P&gt;&lt;P&gt;select empid, ename, sal from emp group by empid;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select empid, ename, max(sal) from emp group by empid;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now which query executes correctly?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sql-queries/m-p/1360170#M822513</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: sql queries</title>
      <link>https://community.qlik.com/t5/QlikView/sql-queries/m-p/1360171#M822514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Neither, unless you have an SQL DBMS that doesn't conform to standard sql.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2017 11:07:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sql-queries/m-p/1360171#M822514</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2017-08-07T11:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: sql queries</title>
      <link>https://community.qlik.com/t5/QlikView/sql-queries/m-p/1360172#M822515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem you have with both queries is if you are doing a "group by" statement in SQL you have to make sure that every field is either part of the "group by" or being aggregated (like "max" in your second statement).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if you change the 2nd statement to be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select empid, ename, max(sal) from emp group by empid, ename;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That should work!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2017 11:48:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sql-queries/m-p/1360172#M822515</guid>
      <dc:creator>chris_johnson</dc:creator>
      <dc:date>2017-08-07T11:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: sql queries</title>
      <link>https://community.qlik.com/t5/QlikView/sql-queries/m-p/1360173#M822516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aggregation and group by goes together always.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) select empid, ename, sal from emp group by empid;&lt;/P&gt;&lt;P&gt; This statement do not need a group by as there is no aggregation(sum/Max/Count etc) involved &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) select empid, ename, max(sal) from emp group by empid;&lt;/P&gt;&lt;P&gt;This statement is partially correct as group by is missing ename.Basically, group by clause should contain all the non aggregated fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hth&lt;/P&gt;&lt;P&gt;Sasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2017 17:17:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sql-queries/m-p/1360173#M822516</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2017-08-07T17:17:57Z</dc:date>
    </item>
  </channel>
</rss>

