tim0822,
I ended up reworking this to use temp tables.
SELECT IDENTITY(int, 1, 1) AS ID, cu.CustomerID, cu.LastName, cu.FirstName, COUNT(*) AS TotCamp
INTO #Cust
FROM Customers cu INNER JOIN
CampaignCustomers cc ON cu.CustomerID = cc.CustomerID
WHERE cc.IsActive = 1
GROUP BY cu.CustomerID, cu.LastName, cu.FirstName
ORDER BY cu.LastName, cu.FirstName, cu.CustomerID
SELECT IDENTITY(int, 1, 1) AS ID, cu.ID AS CuID, cu.CustomerID, cu.LastName, cu.FirstName, ca.CampaignID,
ca.CampaignName
INTO #Camp
FROM #Cust cu INNER JOIN
CampaignCustomers cc ON cu.CustomerID = cc.CustomerID INNER JOIN
Campaigns ca ON cc.CampaignID = ca.CampaignID
WHERE cc.IsActive = 1
GROUP BY cu.ID, cu.CustomerID, cu.LastName, cu.FirstName, ca.CampaignName, ca.CampaignID
ORDER BY cu.ID, cu.CustomerID, cu.LastName, cu.FirstName, ca.CampaignName, ca.CampaignID
SELECT cu.LastName, cu.FirstName, ca.CampaignName,
(SELECT COUNT(cu2.ID)
FROM #Cust cu2
WHERE cu2.ID <= cu.ID) AS Customer_Seq,
(SELECT COUNT(ca2.ID)
FROM #Camp ca2
WHERE ca2.CuID = ca.CuID AND ca2.ID <= ca.ID) AS Campaign_Seq,
cu.TotCamp AS Campaign_Count
FROM #Cust cu INNER JOIN
#Camp ca ON cu.CustomerID = ca.CustomerID
ORDER BY ca.ID
DROP TABLE #Cust
DROP TABLE #Camp
Patrick