<?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: Select using inner join, group by and having in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-using-inner-join-group-by-and-having/m-p/3882387#M932965</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change the fields in the &lt;STRONG&gt;group by&lt;/STRONG&gt; clause as follow:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT a~nr_validacao a~nr_revisao a~atnam a~atwrt
b~cd_gr_regra b~id_sit_regra
INTO TABLE t065
FROM ztbvc_065 AS a INNER JOIN ztbvc_064 AS b
ON a~nr_validacao = b~nr_validacao AND
a~nr_revisao = b~nr_revisao AND
b~cd_gr_regra = v_regra
FOR ALL ENTRIES IN tdados
WHERE atnam = tdados-atnam
AND atwrt = tdados-atwrt

group by: a~nr_validacao, a~nr_Revisao

having cont &amp;gt;= 2.
endselect.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 May 2008 13:54:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-26T13:54:46Z</dc:date>
    <item>
      <title>Select using inner join, group by and having</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-using-inner-join-group-by-and-having/m-p/3882386#M932964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following select, and I don't know  why appear the message 'The column NR_VALIDACAO has two meanings'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;nr_validacao a&lt;/SUB&gt;nr_revisao a&lt;SUB&gt;atnam a&lt;/SUB&gt;atwrt&lt;/P&gt;&lt;P&gt;       b&lt;SUB&gt;cd_gr_regra b&lt;/SUB&gt;id_sit_regra&lt;/P&gt;&lt;P&gt;INTO TABLE t065&lt;/P&gt;&lt;P&gt;FROM ztbvc_065 AS a INNER JOIN ztbvc_064 AS b&lt;/P&gt;&lt;P&gt;ON a&lt;SUB&gt;nr_validacao = b&lt;/SUB&gt;nr_validacao AND&lt;/P&gt;&lt;P&gt;   a&lt;SUB&gt;nr_revisao   = b&lt;/SUB&gt;nr_revisao   AND&lt;/P&gt;&lt;P&gt;   b~cd_gr_regra  = v_regra&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN  tdados&lt;/P&gt;&lt;P&gt;WHERE atnam =  tdados-atnam&lt;/P&gt;&lt;P&gt;  AND atwrt =  tdados-atwrt&lt;/P&gt;&lt;P&gt;   group by: nr_validacao, nr_Revisao&lt;/P&gt;&lt;P&gt;  having cont &amp;gt;= 2.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in table tdados i have 2 atnam and 2 atwrt. &lt;/P&gt;&lt;P&gt;in this select i want only nr_validacao  tha have this 2 atnam and atwrt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tks in advance...&lt;/P&gt;&lt;P&gt;Reward will be given!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gabriel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 13:47:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-using-inner-join-group-by-and-having/m-p/3882386#M932964</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T13:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: Select using inner join, group by and having</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-using-inner-join-group-by-and-having/m-p/3882387#M932965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change the fields in the &lt;STRONG&gt;group by&lt;/STRONG&gt; clause as follow:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT a~nr_validacao a~nr_revisao a~atnam a~atwrt
b~cd_gr_regra b~id_sit_regra
INTO TABLE t065
FROM ztbvc_065 AS a INNER JOIN ztbvc_064 AS b
ON a~nr_validacao = b~nr_validacao AND
a~nr_revisao = b~nr_revisao AND
b~cd_gr_regra = v_regra
FOR ALL ENTRIES IN tdados
WHERE atnam = tdados-atnam
AND atwrt = tdados-atwrt

group by: a~nr_validacao, a~nr_Revisao

having cont &amp;gt;= 2.
endselect.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 13:54:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-using-inner-join-group-by-and-having/m-p/3882387#M932965</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T13:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Select using inner join, group by and having</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-using-inner-join-group-by-and-having/m-p/3882388#M932966</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;Specify the table reference for nr_validacao as a or b as shown below....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;nr_validacao a&lt;/SUB&gt;nr_revisao a&lt;SUB&gt;atnam a&lt;/SUB&gt;atwrt&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;cd_gr_regra b&lt;/SUB&gt;id_sit_regra&lt;/P&gt;&lt;P&gt;INTO TABLE t065&lt;/P&gt;&lt;P&gt;FROM ztbvc_065 AS a INNER JOIN ztbvc_064 AS b&lt;/P&gt;&lt;P&gt;ON a&lt;SUB&gt;nr_validacao = b&lt;/SUB&gt;nr_validacao AND&lt;/P&gt;&lt;P&gt;a&lt;SUB&gt;nr_revisao = b&lt;/SUB&gt;nr_revisao AND&lt;/P&gt;&lt;P&gt;b~cd_gr_regra = v_regra&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN tdados&lt;/P&gt;&lt;P&gt;WHERE atnam = tdados-atnam&lt;/P&gt;&lt;P&gt;AND atwrt = tdados-atwrt&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;group by: a&lt;SUB&gt;nr_validacao, a&lt;/SUB&gt;nr_Revisao&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;having cont &amp;gt;= 2.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 13:58:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-using-inner-join-group-by-and-having/m-p/3882388#M932966</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T13:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Select using inner join, group by and having</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-using-inner-join-group-by-and-having/m-p/3882389#M932967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gabriel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The filed &lt;STRONG&gt;nr_validacao&lt;/STRONG&gt; is present in two of the tables (ztbvc_065 and ztbvc_064 ) So when using this field for grouping in the selection, you have to specify the table name explicitly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;group by: a~nr_validacao, nr_Revisao&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;group by: b~nr_validacao, nr_Revisao&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as per the requirement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;sapd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2008 14:11:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-using-inner-join-group-by-and-having/m-p/3882389#M932967</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-26T14:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Select using inner join, group by and having</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-using-inner-join-group-by-and-having/m-p/3882390#M932968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Plz try to avoid using GROUPBY and ORDERBY clause in SELECT querry as due to the PERFORMANCE issue.&lt;/P&gt;&lt;P&gt;better use SORT stmt on the Internal table after data extraction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful,&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2008 01:51:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-using-inner-join-group-by-and-having/m-p/3882390#M932968</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-27T01:51:15Z</dc:date>
    </item>
  </channel>
</rss>

