Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

SET Operations in Alteryx.

rohit782192
11 - Bolide

Hello Alteryx Team,

 

How can we set operations of SQL in Alteryx .

 

Set operations like as

  1. UNION
  2. UNION ALL
  3. INTERSECT
  4. MINUS

 

3 REPLIES 3
RolandSchubert
16 - Nebula
16 - Nebula

Hi @rohit782192 ,

 

I try to "translate" the PL/SQL to Altery - in fact, to "rebuild" special SQL statements there are often different ways. I've decided for the "most SQL-like" version.

 

There is a UNION tool in Alteryx, but it's more like a UNION ALL in PL/SQL as it simply appends results from SELECT B to the results of SELECT A.

15-01-_2020_10-51-04.png

To get the results a UNION in PL/SQL would return, in Alteryx you would use a UNION tool first and remove the duplicates by a UNIQUE tool

The "U" output anchor returns the respective records.

 

15-01-_2020_11-02-57.png

 

INTERSECT works very similar - in fact it's the other output anchor:

15-01-_2020_11-24-25.png

 

To achieve the MINUS results, you have to add one more tool. You want the records from SELECT A, that are not in SELECT B - that means, removing the duplicates identified by the UNIQUE tool will do the job. For that, we can use a JOIN tool in Alteryx:

 

15-01-_2020_11-25-57.png

 

Hope this is helpful.

 

Best,

 

Roland

 

rohit782192
11 - Bolide

Superb.

 

It is really Help ful.

arunkumark_21
7 - Meteor

Hi, This was indeed useful!

 

one question on Minus Set operation - If we union at the very beginning then how we will ensure it is A - B?
It can also result in B - A. Correct me if I am wrong.

 

If you have sample workflow, could you please attach it.

Labels