I am using this query to get back some reporting numbers. According to the SQL Query Analyser it takes about 5-6 minutes for this query to finish, is there a way I can cut back on the time? Even if it's a minute that's better.
NOTE: the only thing diff. b/w these two queries is the first query refrences on table, and the other calls a different one.
I am using SQL Server 2000 on Windows 2000. And my back-end language is Coldfusion MX.
[sub]
____________________________________
Just Imagine.
[sub]
NOTE: the only thing diff. b/w these two queries is the first query refrences on table, and the other calls a different one.
Code:
select o.offername, o.offer_id, count(distinct f.user_id) as exported, f.offer_id,q.offer_id, q.question_id, q.questionweight
from offers o join [COLOR=red]formanswers[/color] f on f.offer_id = o.offer_id join questions q on q.offer_id = f.offer_id
where exporteddate >= '2/1/2005 00:00:00' and exporteddate <= '2/28/2005 23:59:59' and q.questionweight > 0 and f.exported = 1
group by o.offername, o.offer_id, f.offer_id,q.question_id, q.offer_id, q.questionweight
UNION
select o.offername, o.offer_id, count(distinct f.user_id) as exported, f.offer_id,q.offer_id, q.question_id, q.questionweight
from offers o join [COLOR=red]answers[/color] f on f.offer_id = o.offer_id join questions q on q.offer_id = f.offer_id
where exporteddate >= '2/1/2005 00:00:00' and exporteddate <= '2/28/2005 23:59:59' and q.questionweight > 0 and f.exported = 1
group by o.offername, o.offer_id, f.offer_id, q.question_id, q.offer_id, q.questionweight
order by o.offername
I am using SQL Server 2000 on Windows 2000. And my back-end language is Coldfusion MX.
[sub]
____________________________________
Just Imagine.
[sub]