Skip to Content

Table Join in CDS

Hi Experts,

I would like to Join two table in CDS and bring the uncommon entries from one table. I have trieed join condition with NOT operator on key field but it does not work. Below is the example of output what i am trying to achieve. If anybody has already implemented this please can you help.

Regards,

Nitin

capture.jpg (21.2 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Feb 05, 2019 at 02:17 PM

    Assuming you are working with ABAP CDS views you can do that for instance like following:

    define view MyView as select from Table1 as t1
      left outer join Table2 as t2 on t1.ID = t2.ID {
        t1.ID,
        t1.Value
    } where t2.ID is null;
    
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 06, 2019 at 05:53 AM

    Hi Nitin,

    I am confused about your question,

    1. If your are choosing Inner join your output will be, 100 and 400.
    2. If your are choosing outer join your output will be, 200 and 300.

    But The Image you have post will appear for both logic where output given is 200 which is outer join and 400 which is inner join.

    Logic is missing here, I think.

    Thank you

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 05, 2019 at 01:56 PM
    -4

    SELECT * FROM Table1 WHERE " ID" IN ( SELECT "ID" FROM "Table1" EXCEPT SELECT "ID" FROM "Table2" )

    Hope this solves your issue.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.