J
Juan Schwartz
I am getting an error message with the following query. Could someone
post an example of how to do what I'm attempting so that I can
understand how it's supposed to work?
I have 5 tables. I am trying to do a union on all 5 and add up the
counts of records in all 5 and total them by Name. The output should
end up as
Name Count
---------------------------
Name1 10
Name2 24
Error Message:You tried to execute a query that does not include the
specified function 'Name' as part of an aggragate function.
SELECT MonitorName As Name, Count([MonitorEntry(Business)].MonitorID)
AS Count FROM [MonitorEntry(Business)],[MonitorID]
WHERE [MonitorID].[MonitorID] = [MonitorEntry(Business)].MonitorID
UNION ALL
SELECT MonitorName As Name,Count([MonitorEntry(Collection)].MonitorID)
AS Count FROM [MonitorEntry(Collection)],[MonitorID]
WHERE [MonitorID].[MonitorID] = [MonitorEntry(Collection)].MonitorID
UNION ALL
SELECT MonitorName As Name,Count([MonitorEntry(Retention)].MonitorID)
AS Count FROM [MonitorEntry(Retention)],[MonitorID]
WHERE [MonitorID].[MonitorID] = [MonitorEntry(Retention)].MonitorID
UNION ALL
SELECT MonitorName As Name,Count([MonitorEntry(Sales)].MonitorID) AS
Count FROM [MonitorEntry(Sales)],[MonitorID]
WHERE [MonitorID].[MonitorID] = [MonitorEntry(Sales)].MonitorID
UNION ALL
SELECT MonitorName As Name,Count([MonitorEntry(TechSupport)].MonitorID)
AS Count FROM [MonitorEntry(TechSupport)],[MonitorID]
WHERE [MonitorID].[MonitorID] = [MonitorEntry(TechSupport)].MonitorID
GROUP BY Name
post an example of how to do what I'm attempting so that I can
understand how it's supposed to work?
I have 5 tables. I am trying to do a union on all 5 and add up the
counts of records in all 5 and total them by Name. The output should
end up as
Name Count
---------------------------
Name1 10
Name2 24
Error Message:You tried to execute a query that does not include the
specified function 'Name' as part of an aggragate function.
SELECT MonitorName As Name, Count([MonitorEntry(Business)].MonitorID)
AS Count FROM [MonitorEntry(Business)],[MonitorID]
WHERE [MonitorID].[MonitorID] = [MonitorEntry(Business)].MonitorID
UNION ALL
SELECT MonitorName As Name,Count([MonitorEntry(Collection)].MonitorID)
AS Count FROM [MonitorEntry(Collection)],[MonitorID]
WHERE [MonitorID].[MonitorID] = [MonitorEntry(Collection)].MonitorID
UNION ALL
SELECT MonitorName As Name,Count([MonitorEntry(Retention)].MonitorID)
AS Count FROM [MonitorEntry(Retention)],[MonitorID]
WHERE [MonitorID].[MonitorID] = [MonitorEntry(Retention)].MonitorID
UNION ALL
SELECT MonitorName As Name,Count([MonitorEntry(Sales)].MonitorID) AS
Count FROM [MonitorEntry(Sales)],[MonitorID]
WHERE [MonitorID].[MonitorID] = [MonitorEntry(Sales)].MonitorID
UNION ALL
SELECT MonitorName As Name,Count([MonitorEntry(TechSupport)].MonitorID)
AS Count FROM [MonitorEntry(TechSupport)],[MonitorID]
WHERE [MonitorID].[MonitorID] = [MonitorEntry(TechSupport)].MonitorID
GROUP BY Name