I want to index this view but because it has subquery i cant index. Can anyone suggest how to change this view so that i can index it.
ALTER VIEW [dbo].[Recon2]
WITH SCHEMABINDING
AS
SELECT
dbo.Transactions.CustomerCode,
dbo.Customer_Master.CustomerName,
dbo.Transactions.TransDate,
dbo.Transactions.PubCode,
dbo.Transactions.TransType,
dbo.Transactions.Copies,
SUM(dbo.Transactions.TotalAmount) AS TotalAmount,
'0' AS ReceiptNo,
'2008-01-01' AS PaymentDate,
0 AS Amount,
dbo.Transactions.Period,
dbo.Transactions.Year,
dbo.Publication_Master.PubName,
dbo.Customer_Master.SalesCode,
COUNT_BIG(*) AS COUNT
FROM
dbo.Publication_Master INNER JOIN
dbo.Customer_Master INNER JOIN
dbo.Transactions ON dbo.Customer_Master.CustomerCode = dbo.Transactions.CustomerCode ON
dbo.Publication_Master.PubCode = dbo.Transactions.PubCode
WHERE
(dbo.Customer_Master.CustomerCode NOT IN
(SELECT CustomerCode
FROM dbo.StreetSaleRcpt
WHERE (PubCode = dbo.Transactions.PubCode) AND
(TransactionDate = dbo.Transactions.TransDate) AND
(Updated = 1) AND
(PeriodMonth = dbo.Transactions.Period) AND
(PeriodYear = dbo.Transactions.Year)))
GROUP BY dbo.Transactions.CustomerCode, dbo.Customer_Master.CustomerName, dbo.Transactions.TransDate, dbo.Transactions.PubCode,
dbo.Publication_Master.PubName, dbo.Customer_Master.SalesCode, dbo.Transactions.[Update], dbo.Transactions.TransType,
dbo.Transactions.Copies, dbo.Transactions.Period, dbo.Transactions.Year, dbo.Transactions.TotalAmount