1

At the minute I have 2 lists of data from 2 different queries and sources, for example I have:

Source 1

Red
Blue
White
Green
Black

Source 2

Red
Blue
Black

I want to be able to compare the 2 and show the ones that are missing from Source 2 (White and Green) in a table.

I have tried various options within Transform but can't seem to get it to do what I need.

Dale K
  • 25,246
  • 15
  • 42
  • 71
user2572639
  • 55
  • 1
  • 11

2 Answers2

0

Try the following:

SELECT S1.Item
FROM Source1 AS S1
LEFT JOIN Source2 AS S2 ON S1.Item = S2.Item
WHERE S2.Item IS NULL

Or :

SELECT Item
FROM Source1
EXCEPT
SELECT Item
FROM Source2
Amira Bedhiafi
  • 8,088
  • 6
  • 24
  • 60
0

In case your actual dataset for second query include something more than a single column:

Use two transformations:

  1. "Join by field"
  • Mode: OUTER,
  • Field: name of column with the same values (columns have to be named the same in both datasets),
  1. "Filter data by values"
  • Filter type: EXCLUDE,
  • Conditions: Match all,
    and add a condition for every column present in dataset 2 (except for the "key" column): Is null.

If your actual dataset for second query contains only key fields, you'll need to modify your queries to have additional columns.

For example, it can be done with query

with t1 as (
  --your original query here
)
select val, val unique2 from t1
-- val here is assumed name of your "key" column

Then apply solution described above, with additional Transformation "Organize fields", to hide additional column.

markalex
  • 8,623
  • 2
  • 7
  • 32