G
Guest
The following query returns unique combinations and record count of the
[Reporting Unit] and [Group] columns in table [Location] having more than one
[Group] column value.
This works fine, but after saving it and re-opening in SQL view I see that
the parentheses around the subquery select statements have been replaced with
square brackets (plus a period after closing brackets). Oddly, the query will
still execute in this state, but any editing of the SQL code causes the
improper bracketing to result in an error. This can resolved by changing the
brackets back to parentheses and deleting the inserted periods, but this
should not be needed.
Does anyone have an idea what is causing this, or better yet, a way to
prevent it from happening???
SELECT C.[Reporting Unit], C.Group, C.Recs
FROM (SELECT [Reporting Unit] FROM
(SELECT [Reporting Unit], Group
FROM [Location]
GROUP BY [Reporting Unit], Group) A
GROUP BY A.[Reporting Unit] HAVING Count(*) >1) AS B INNER JOIN (SELECT
[Reporting Unit], Group, Count(*) AS Recs FROM [Location] GROUP BY [Reporting
Unit], Group) AS C ON B.[Reporting Unit] = C.[Reporting Unit];
FYI, I am using Access 2002 on Windows XP.
Thanks for any comments,
TK
[Reporting Unit] and [Group] columns in table [Location] having more than one
[Group] column value.
This works fine, but after saving it and re-opening in SQL view I see that
the parentheses around the subquery select statements have been replaced with
square brackets (plus a period after closing brackets). Oddly, the query will
still execute in this state, but any editing of the SQL code causes the
improper bracketing to result in an error. This can resolved by changing the
brackets back to parentheses and deleting the inserted periods, but this
should not be needed.
Does anyone have an idea what is causing this, or better yet, a way to
prevent it from happening???
SELECT C.[Reporting Unit], C.Group, C.Recs
FROM (SELECT [Reporting Unit] FROM
(SELECT [Reporting Unit], Group
FROM [Location]
GROUP BY [Reporting Unit], Group) A
GROUP BY A.[Reporting Unit] HAVING Count(*) >1) AS B INNER JOIN (SELECT
[Reporting Unit], Group, Count(*) AS Recs FROM [Location] GROUP BY [Reporting
Unit], Group) AS C ON B.[Reporting Unit] = C.[Reporting Unit];
FYI, I am using Access 2002 on Windows XP.
Thanks for any comments,
TK