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?
@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.
Thank you! I will try it out!
User | Count |
---|---|
52 | |
27 | |
25 | |
24 | |
21 |