Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Multiple Sql queries linking

Niru
8 - Asteroid

Dear All,

 

i am using multiple sql queries for my daily BAU, Here i am joining Query1 to Query2 , Query12 output im joining with Query3 same way for all the queries. Is there any way can i built same logic in Alteryx.  Please find the below screen shot for the logic.

kindly help me.

 

Query.PNG

Thanks & Regards.

Niru

4 REPLIES 4
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @Niru,

 

This could be achieved with a series of join tools in conjunction with union tools to create the relevant left and right joins whilst querying your database with the standard input tool:

Jonathan-Sherman_0-1622229613384.png

 

I've attached my workflow for you to download if needed!

 

Kind regards,

Jonathan

 

 

 

Niru
8 - Asteroid

@Jonathan-Sherma, Thanks a lot for your reply, sorry for my late reply,

 

im pulling directly data from sql server. Here each table has millions of records. With Query1 matching records i need to pull data from other tables. Is there any way i can pull only matching from other tables without using join ( if I use join it is taking more than 4 or 5 hours to pull the data other tables).kindly help me 

 

Thanks in Advance

Niru

 

ueyhdga
5 - Atom
In this step, you create the union query by copying and pasting the SQL statements.
  1. On the Create tab, in the Queries group, click Query Design.
  2. On the Design tab, in the Query group, click Union. ...
  3. Click the tab for the first select query that you want to combine in the union query.
Procedure
  1. To combine two or more SELECT statements to form a single result table, use the set operators: UNION, EXCEPT or INTERSECT. ...
  2. To keep all duplicate rows when combining result tables, specify the ALL keyword with the set operator clause.

As you can see, joining three tables in SQL isn't as hard as it sounds. In fact, you can join as many tables as you like – the idea behind it is the same as joining only two tables. It's very helpful to take a look at the data midstep Find cheats for gun blood at Scream Reality and imagine that the tables you've already joined are one table.

Niru
8 - Asteroid

Hi @ueyhdga, Thanks for your detailed reply,

 

i followed the same process to build the query, Here i got the unexpected result, im unable to validate my information. 

Is there anyway I can include 1st query output in second query where condition. Please suggest me any other way.

 

Thanks in Advance

Niru

 

 Join.PNG

Labels