Wednesday, January 25, 2006

optimized index

Compound Index:
DatePaid
ReceivedAtBranch




SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

alter PROCEDURE FinancingDrrAllBranch
@D DATETIME
AS

SELECT P.ReceivedAtBranch, B.BranchName, DailyCollection = SUM(P.Payment)
FROM AccountInstallmentFinancingDetailFinal AS P
INNER JOIN Branch AS B ON P.ReceivedAtBranch = B.BranchCode
WHERE P.DatePaid = @D
AND P.OrNo <> '' AND P.OrNo <> 'ADJ'
GROUP BY P.ReceivedAtBranch, B.BranchName


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

0 Comments:

Post a Comment

<< Home