<?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: Problem in making SQL Query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-making-sql-query/m-p/953633#M65719</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;look f1 to subquery and try that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT f1 f2 from egerr
   where 
  ...                    
*subquery
                   
                    AND anlage NOT IN
                     ( SELECT  f1  FROM  eastl
                            WHERE  ... )
                  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jul 2005 06:42:38 GMT</pubDate>
    <dc:creator>andreas_mann3</dc:creator>
    <dc:date>2005-07-21T06:42:38Z</dc:date>
    <item>
      <title>Problem in making SQL Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-making-sql-query/m-p/953629#M65715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have one problem regarding sql query.&lt;/P&gt;&lt;P&gt;I have one internal table which contains equnr and bis as fields. There are two database tables egerr and eastl. The structure for tables are as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fields for egerr:&lt;/P&gt;&lt;P&gt;equnr, bis, logiknr in which first two fields form key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field for eastl:&lt;/P&gt;&lt;P&gt;anlage, bis, logiknr in which all fields form primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to select records from internal table which does not have record in eastl. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the reference we can extract logiknr from egerr by using intarnal table and then use this logiknr to check entry in table eastl. but i want those equnr which are in internal table but not mapped in eastl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the most efficient solution for this as there are many records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks..... and if you have any queries then let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jignesh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2005 05:47:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-making-sql-query/m-p/953629#M65715</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-21T05:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in making SQL Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-making-sql-query/m-p/953630#M65716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;as per ur statement, u want the field equnr which exists in the internal table but not in eastl. now for comparing with eastl u will need to check for all the three fields as they form the key...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get data from egerr for matching equnr and bis in your internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e. assuming ur table is itab  and itab_logiknr contains a single field logiknr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select logiknr from egerr &lt;/P&gt;&lt;P&gt;  into table itab_logiknr &lt;/P&gt;&lt;P&gt;  for all entries in itab&lt;/P&gt;&lt;P&gt;  where equnr eq itab-equnr &lt;/P&gt;&lt;P&gt;    and bis eq itab-bis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now from this data (itab_egerr), compare the data with that in eastl for matching (or non matching) values of logiknr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assuming data from eastl lies in itab_eastl&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select anlage bis logiknr from eastl into itab_eastl&lt;/P&gt;&lt;P&gt;for all entries in itab_logiknr &lt;/P&gt;&lt;P&gt;where logiknr eq itab_logiknr-logiknr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for non matching entries u can select data from eastl which is not present in itab_eastl now....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(but mind you....since all fields of eastl form the key, u might not be getting the correct data) so if possible study ur scenario again and see if u can search the eastl table comparing all fields in the primary key)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this....get back in case of any clarifications&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it gives u some pointers...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;PJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2005 06:00:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-making-sql-query/m-p/953630#M65716</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-21T06:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in making SQL Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-making-sql-query/m-p/953631#M65717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priyank,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"for non matching entries u can select data from eastl which is not present in itab_eastl now...."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to extract those equnr which are in internal table itab but they dont have entry(corresponding logiknr) in eastl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you give me the exact query i should go for? I dont want the records which have corresponding entry in eastl but i want those records who dont have entries in eastl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help buddy !!!!!!! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jignesh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2005 06:15:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-making-sql-query/m-p/953631#M65717</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-21T06:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in making SQL Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-making-sql-query/m-p/953632#M65718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;once u have the data in itab_logiknr, these are only for existing equnr in egerr and matching entries in your internal table....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now u can use the following select&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select anlage bis logiknr from eastl into table itab_eastl &lt;/P&gt;&lt;P&gt;for all entries in itab_logiknr &lt;/P&gt;&lt;P&gt;where logiknr ne itab_logiknr-logiknr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see if this solves ur purpose.....but keep in mind the caution i mentioned earlier &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;PJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2005 06:22:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-making-sql-query/m-p/953632#M65718</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-21T06:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in making SQL Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-making-sql-query/m-p/953633#M65719</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;look f1 to subquery and try that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT f1 f2 from egerr
   where 
  ...                    
*subquery
                   
                    AND anlage NOT IN
                     ( SELECT  f1  FROM  eastl
                            WHERE  ... )
                  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2005 06:42:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-making-sql-query/m-p/953633#M65719</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2005-07-21T06:42:38Z</dc:date>
    </item>
  </channel>
</rss>

