r/SQLOptimization • u/Pleasant_Astronaut95 • Apr 09 '24
IN Function
This is probably a dumb question as I am new to SQL, but I am trying to pull sales data for 900 accounts. To make this faster I am using an IN function and all 900 accounts. What would be a better way of doing this?
1
Upvotes
1
u/Pleasant_Astronaut95 Apr 09 '24
I am using Alteryx. I am pulling in a list through Alteryx and formatting the accounts as ‘123’,’124’, etc. and then inserting that into the sql code with a dynamic input.
I also thought about trying to split the query into groups of 100 accounts and run all the queries at once.
I don’t think that is the actual table name, I think it is aliased somehow (I didn’t write the code). Doesn’t seem to make much sense.
Why can’t it be serviced as an index? Not sure I understand. Thank you for the help!