cancel
Showing results for 
Search instead for 
Did you mean: 

Table Join in CDS

0 Kudos

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

pfefferf
Active Contributor

Do you expect 200 and 400 in the result or 200 and 300 (like I would expect)?

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor

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;

Answers (2)

Answers (2)

sudarshan_d29
Active Participant

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

former_member597564
Participant
0 Kudos

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

Hope this solves your issue.