G
GEORGIA
I have a subquery which is running very slow.
here's my SQL statement:
SELECT s.CCC, s.[91+]
FROM qrytagbyccc AS s
WHERE (((s.[91+]) In (select top 3 t.[91+ ]
from qrytagbyccc as t
where t.ccc = s.ccc
order by t.[91+] desc)))
ORDER BY s.CCC, s.[91+] DESC;
(this query runs very very slow!)
qrytagbyccc SQL statement is this:
SELECT IIf([marketplace] Like "atlanta*" Or
[CSC_CODE]="FLD","ATL",IIf([marketplace] Like "houston*" Or [CSC_CODE]="GLD"
Or [CSC_CODE]="CEN","HOU",IIf([CSC_CODE]="NWD" Or
[CSC_CODE]="WED","Tempe",""))) AS CCC,
CCur(Sum([091-120]+[121-150]+[151-180]+[181-360]+[361+])) AS [91+]
FROM tblTag
GROUP BY tblTag.CSC_CODE, tblTag.Marketplace, tblTag.Collector_Id
HAVING (((tblTag.Collector_Id)<>"0" And (tblTag.Collector_Id)<>"10622"));
any suggestion on how to make it run faster?
here's my SQL statement:
SELECT s.CCC, s.[91+]
FROM qrytagbyccc AS s
WHERE (((s.[91+]) In (select top 3 t.[91+ ]
from qrytagbyccc as t
where t.ccc = s.ccc
order by t.[91+] desc)))
ORDER BY s.CCC, s.[91+] DESC;
(this query runs very very slow!)
qrytagbyccc SQL statement is this:
SELECT IIf([marketplace] Like "atlanta*" Or
[CSC_CODE]="FLD","ATL",IIf([marketplace] Like "houston*" Or [CSC_CODE]="GLD"
Or [CSC_CODE]="CEN","HOU",IIf([CSC_CODE]="NWD" Or
[CSC_CODE]="WED","Tempe",""))) AS CCC,
CCur(Sum([091-120]+[121-150]+[151-180]+[181-360]+[361+])) AS [91+]
FROM tblTag
GROUP BY tblTag.CSC_CODE, tblTag.Marketplace, tblTag.Collector_Id
HAVING (((tblTag.Collector_Id)<>"0" And (tblTag.Collector_Id)<>"10622"));
any suggestion on how to make it run faster?