G
Guest
I have a query that's running exceptionally slow. I've never seen a query
bahave this way but when the table view comes up, that data slowly fils in
each of the fields and if I scroll to the right, it slowly fills in again
cell-by-cell. The only thing that's onusual about this query is that is ises
a couple of custom functions that I downloaded from various places. Could
this be the issue? If so, what can I do about it?
I've posted the SQL below
SELECT dbo_DailyHist.sCliNum, dbo_DailyHist.dtSysMon,
First(dbo_DailyHistRange.dtBegDate) AS FirstOfdtBegDate,
Last(dbo_DailyHistRange.dtEndDate) AS LastOfdtEndDate,
Sum(dbo_DailyHist.cSales) AS SumOfcSales, ([SumOfcSales]/[Interval
workday])*[IntervalBusMonth] AS NSales, ([SumOfcNetCollect]/[Interval
workday])*[IntervalBusMonth] AS NCollections, Sum(dbo_DailyHist.cCredits) AS
SumOfcCredits, Sum(dbo_DailyHist.cPlusAdj) AS SumOfcPlusAdj,
Sum(dbo_DailyHist.cNegAdj) AS SumOfcNegAdj, Sum(dbo_DailyHist.cNetCollect) AS
SumOfcNetCollect, Sum(dbo_DailyHist.cDiscounts) AS SumOfcDiscounts,
WorkingDays2([FirstOfdtBegDate],[LastOfdtEndDate]) AS [Interval workday],
FirstWorkDayOfMonth(dbo_DailyHist!dtSysMon) AS Expr1,
LastWorkDayOfMonth(dbo_DailyHist!dtSysMon) AS Expr2,
WorkingDays2([expr1],[expr2]) AS IntervalBusMonth
FROM dbo_DailyHistRange INNER JOIN dbo_DailyHist ON
(dbo_DailyHistRange.sAssignNum = dbo_DailyHist.sAssignNum) AND
(dbo_DailyHistRange.sRandNum = dbo_DailyHist.sRandNum) AND
(dbo_DailyHistRange.sTime = dbo_DailyHist.sTime) AND
(dbo_DailyHistRange.dtSysMon = dbo_DailyHist.dtSysMon) AND
(dbo_DailyHistRange.dtProc = dbo_DailyHist.dtProc) AND
(dbo_DailyHistRange.sLoanNum = dbo_DailyHist.sLoanNum) AND
(dbo_DailyHistRange.sCoNum = dbo_DailyHist.sCoNum) AND
(dbo_DailyHistRange.sCliNum = dbo_DailyHist.sCliNum)
WHERE (((dbo_DailyHistRange.sAssignNum) Like "*BB*"))
GROUP BY dbo_DailyHist.sCliNum, dbo_DailyHist.dtSysMon,
([SumOfcSales]/[Interval workday])*[IntervalBusMonth]
HAVING (((First(dbo_DailyHistRange.dtBegDate)) Is Not Null) AND
((Last(dbo_DailyHistRange.dtEndDate)) Is Not Null))
ORDER BY dbo_DailyHist.sCliNum, dbo_DailyHist.dtSysMon;
bahave this way but when the table view comes up, that data slowly fils in
each of the fields and if I scroll to the right, it slowly fills in again
cell-by-cell. The only thing that's onusual about this query is that is ises
a couple of custom functions that I downloaded from various places. Could
this be the issue? If so, what can I do about it?
I've posted the SQL below
SELECT dbo_DailyHist.sCliNum, dbo_DailyHist.dtSysMon,
First(dbo_DailyHistRange.dtBegDate) AS FirstOfdtBegDate,
Last(dbo_DailyHistRange.dtEndDate) AS LastOfdtEndDate,
Sum(dbo_DailyHist.cSales) AS SumOfcSales, ([SumOfcSales]/[Interval
workday])*[IntervalBusMonth] AS NSales, ([SumOfcNetCollect]/[Interval
workday])*[IntervalBusMonth] AS NCollections, Sum(dbo_DailyHist.cCredits) AS
SumOfcCredits, Sum(dbo_DailyHist.cPlusAdj) AS SumOfcPlusAdj,
Sum(dbo_DailyHist.cNegAdj) AS SumOfcNegAdj, Sum(dbo_DailyHist.cNetCollect) AS
SumOfcNetCollect, Sum(dbo_DailyHist.cDiscounts) AS SumOfcDiscounts,
WorkingDays2([FirstOfdtBegDate],[LastOfdtEndDate]) AS [Interval workday],
FirstWorkDayOfMonth(dbo_DailyHist!dtSysMon) AS Expr1,
LastWorkDayOfMonth(dbo_DailyHist!dtSysMon) AS Expr2,
WorkingDays2([expr1],[expr2]) AS IntervalBusMonth
FROM dbo_DailyHistRange INNER JOIN dbo_DailyHist ON
(dbo_DailyHistRange.sAssignNum = dbo_DailyHist.sAssignNum) AND
(dbo_DailyHistRange.sRandNum = dbo_DailyHist.sRandNum) AND
(dbo_DailyHistRange.sTime = dbo_DailyHist.sTime) AND
(dbo_DailyHistRange.dtSysMon = dbo_DailyHist.dtSysMon) AND
(dbo_DailyHistRange.dtProc = dbo_DailyHist.dtProc) AND
(dbo_DailyHistRange.sLoanNum = dbo_DailyHist.sLoanNum) AND
(dbo_DailyHistRange.sCoNum = dbo_DailyHist.sCoNum) AND
(dbo_DailyHistRange.sCliNum = dbo_DailyHist.sCliNum)
WHERE (((dbo_DailyHistRange.sAssignNum) Like "*BB*"))
GROUP BY dbo_DailyHist.sCliNum, dbo_DailyHist.dtSysMon,
([SumOfcSales]/[Interval workday])*[IntervalBusMonth]
HAVING (((First(dbo_DailyHistRange.dtBegDate)) Is Not Null) AND
((Last(dbo_DailyHistRange.dtEndDate)) Is Not Null))
ORDER BY dbo_DailyHist.sCliNum, dbo_DailyHist.dtSysMon;