There is probably an obvious answer to this question, but I have one minute of time ever with her.
Consider the query:
SELECT *
FROM reports AS r
JOIN reportvalues AS rv ON rv.report_id = r.report_id
JOIN metrics AS m ON m.metric_id = rv.metric_id
WHERE r.report_id NOT IN (
SELECT DISTINCT report_id
FROM exclude_report
)
In this query exclude_report, this is a view constructed in a similar fashion.
Now it happens that the query takes EXTREMELY for a long time to execute, apparently because the subquery is executed for each row in the parent query. However, I do not find any possible ways to do this in any other way.
Great SQL Wizards, please advise. I really need a way to do all this in SQL, which I will use in SSRS.
source
share