<?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: Is it possible to do nested select on DDL / SQL? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-do-nested-select-on-ddl-sql/m-p/12165037#M1978417</link>
    <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;mchua9&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;It's currently not possible in ABAP CDS, but you an do this in an another way using left outer join. check out the code below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;@AbapCatalog.sqlViewName: 'ZVSBOOKSTEST'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'test'
define view zsbookstest as select from sbook 
                           left outer join sbuspart
                                        on sbuspart.buspartnum = sbook.customid
                                       and sbook.passname is initial {
    sbook.bookid,
    case when passname is initial then sbuspart.contact else passname end as passname
}


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;-Mahesh&lt;/P&gt;</description>
    <pubDate>Fri, 15 May 2020 13:43:43 GMT</pubDate>
    <dc:creator>maheshpalavalli</dc:creator>
    <dc:date>2020-05-15T13:43:43Z</dc:date>
    <item>
      <title>Is it possible to do nested select on DDL / SQL?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-do-nested-select-on-ddl-sql/m-p/12165036#M1978416</link>
      <description>&lt;P&gt;I have a problem with the nested select, I just want to select the text when custtype = B,&lt;/P&gt;
  &lt;P&gt;can you suggest an approach that I can try to implement for this solution? Thank you!&lt;/P&gt;
  &lt;P&gt;the 1st one is SQL console, &lt;/P&gt;
  &lt;P&gt;2nd one is CDS DDL&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1808795-sbook-sql.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1808796-sbook-cds.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 12:26:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-do-nested-select-on-ddl-sql/m-p/12165036#M1978416</guid>
      <dc:creator>former_member679084</dc:creator>
      <dc:date>2020-05-15T12:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to do nested select on DDL / SQL?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-do-nested-select-on-ddl-sql/m-p/12165037#M1978417</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;mchua9&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;It's currently not possible in ABAP CDS, but you an do this in an another way using left outer join. check out the code below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;@AbapCatalog.sqlViewName: 'ZVSBOOKSTEST'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'test'
define view zsbookstest as select from sbook 
                           left outer join sbuspart
                                        on sbuspart.buspartnum = sbook.customid
                                       and sbook.passname is initial {
    sbook.bookid,
    case when passname is initial then sbuspart.contact else passname end as passname
}


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;-Mahesh&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 13:43:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-do-nested-select-on-ddl-sql/m-p/12165037#M1978417</guid>
      <dc:creator>maheshpalavalli</dc:creator>
      <dc:date>2020-05-15T13:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to do nested select on DDL / SQL?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-do-nested-select-on-ddl-sql/m-p/12165038#M1978418</link>
      <description>&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1808826-sbook.jpg" /&gt;&lt;/P&gt;&lt;P&gt;ok thanks, that's too bad then..&lt;/P&gt;&lt;P&gt;this is now my working code. it seems like when you add "and sbook.passname isinitial" from outside the clause runtime is slower though its just around ~10-15ms per 5000 line on 10 runs I have tried&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 08:13:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-do-nested-select-on-ddl-sql/m-p/12165038#M1978418</guid>
      <dc:creator>former_member679084</dc:creator>
      <dc:date>2020-05-16T08:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to do nested select on DDL / SQL?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-do-nested-select-on-ddl-sql/m-p/12165039#M1978419</link>
      <description>&lt;P&gt;great!, I didn't know adding where clause of is initial in join will slow it donw,, i thought we will be filtering unrequired data.. Thanks for the tip.&lt;/P&gt;&lt;P&gt;You can close the question if your query is answered.&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2017/08/15/what-to-do-with-my-answered-questions/"&gt;https://blogs.sap.com/2017/08/15/what-to-do-with-my-answered-questions/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 17 May 2020 06:09:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-it-possible-to-do-nested-select-on-ddl-sql/m-p/12165039#M1978419</guid>
      <dc:creator>maheshpalavalli</dc:creator>
      <dc:date>2020-05-17T06:09:05Z</dc:date>
    </item>
  </channel>
</rss>

