I have select sql query being used in SSRS report which is taking a long time to execute. I currently execute the sql query in few step by storing the results from each step into temp tables, rather than running a single select at one time. The performance has not improved a lot. The sql table currently has 33 million rows.
I am looking for ideas to have the sql query optimized to improve the performance. Please see attached query and sql for tables used in the query. If interested and if you have query optimized, then we can run it on actual database to check performance