Skip to content
Advertisement

Append Group with data from another table based on its existence in first table

I have a table like this

I have another table with these data

Based on the second table I need to find which phases are missing for each Project codes

So I need to get a result like this

I tried cross join it doesn work since its creating 4 entries for each one item in the first table. So how can I achieve the above result check whether Phase is existing for each group?

So what I am expecting is to append each group of PCodes with that from Phase table but append only those not in first group

Advertisement

Answer

Try this:

Demo here

To better understand how the query works you can have a look at the rows of derived table t1:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement