Below is a statement that works correctly; however, when I open it to make a change, part of the statement is automatically changed and causes an error in the query.
This is what the sql looks like after I open it in design view, but before I correct it (blue and red text):
The '(' for the select statements change to a '['. I have never run into this before. Any thoughts?
Code:
SELECT [CurCount]/[PrCount] AS 7RollRate, T1.CurMonth, 7 AS Bucket, (SELECT MAX(BusinessDt) FROM WVR) AS BusinessDt
FROM (SELECT Sum(WVR.Count) AS CurCount, Month([BusinessDt]) AS CurMonth, WVR.Owner AS CurOwner
FROM WVR
WHERE (((WVR.BusinessDt)=(SELECT MAX(BusinessDt) FROM WVR)) AND ((WVR.Bucket)=7))
GROUP BY Month([BusinessDt]), WVR.Owner
HAVING (((WVR.Owner)="Collections"))) AS T1, (SELECT Sum(WVR.Count) AS PrCount, Month([BusinessDt]) AS [PrMonth], WVR.Owner AS PrOwner
FROM WVR
WHERE (((WVR.BusinessDt)=DateAdd("m",-1,(SELECT MAX(BusinessDt) FROM WVR))) AND ((WVR.Bucket)=6))
GROUP BY Month([BusinessDt]), WVR.Owner
HAVING (((WVR.Owner)="Collections"))) AS T2;
This is what the sql looks like after I open it in design view, but before I correct it (blue and red text):
Code:
SELECT [CurCount]/[PrCount] AS 7RollRate, T1.CurMonth, 7 AS Bucket, (SELECT MAX(BusinessDt) FROM WVR) AS BusinessDt
FROM [COLOR=blue][SELECT Sum(WVR.Count) AS CurCount, Month([BusinessDt]) AS CurMonth, WVR.Owner AS CurOwner
FROM WVR
WHERE (((WVR.BusinessDt)=(SELECT MAX(BusinessDt) FROM WVR)) AND ((WVR.Bucket)=7))
GROUP BY Month([BusinessDt]), WVR.Owner
HAVING (((WVR.Owner)="Collections"))]. AS T1,[/color] [COLOR=red] [SELECT Sum(WVR.Count) AS PrCount, Month([BusinessDt]) AS [PrMonth], WVR.Owner AS PrOwner
FROM WVR
WHERE (((WVR.BusinessDt)=DateAdd("m",-1,(SELECT MAX(BusinessDt) FROM WVR))) AND ((WVR.Bucket)=6))
GROUP BY Month([BusinessDt]), WVR.Owner
HAVING (((WVR.Owner)="Collections"))]. AS T2;[/color]
The '(' for the select statements change to a '['. I have never run into this before. Any thoughts?