Start Free Trial

Alteryx Designer Desktop Discussions

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

Using a macro to piecemeal SQL input

vertika
6 - Meteoroid

I have an input tool as a SQL code. It is a fair amount of data for a year, and the query times out (as per our database timeout rules). I split the query based on date for each month and unioned all the inputs together. It works, but as the data grows this solution is not sustainable. I cannot simply append the data for each month as the historical values change.

 

I am trying to find a solution so that I can pull the data using a macro.

 

This is what my query looks like -

 

SELECT * FROM A 

LEFT JOIN B on [condition]

WHERE A.DATE_OPEN>='2020-01-01' AND A.DATE_OPEN <'2020-02-01'

AND B.DATE_APPLIED>='2020-01-01' ----This pulls data for January from table A, and everything after January from Table B

 

SELECT * FROM A

LEFT JOIN B  on [condition]

WHERE A.DATE_OPEN>='2020-02-01' AND A.DATE_OPEN <'2020-03-01'

AND B.DATE_APPLIED>='2020-02-01' ---This pulls data for  February from table A, and everything after February from Table B

 

How do I achieve this usng a macro?

 

2 REPLIES 2
Qiu
21 - Polaris
21 - Polaris

@vertika 
I think it might be applicable with a Batch Macro given the two queries will return the data with same schema.
I am sorry I did not really test it since I dont possess a test enviroment.

20210320-vertika.PNG

vertika
6 - Meteoroid

Thank you! I will try it out!

Labels
Top Solution Authors