Make this SQL query faster

Job ID: 33732811

Budget: $10 – $30 AUD

I am using SQL Server 2019

I have an SQL query
it takes more than an hour to finish

a friend told me this can be improved significantly and finish this query in a few minutes.


The query and tables files are in the attachment

files end with csv should become a table in SQL

there is a function called Dist()
and query called Q.sql

just make an offer if you really can improve significantly and tell me what is the time it will take to run the query