McGillivray, Don
DMcGillivray at ctc.ca.gov
Mon Dec 12 10:57:28 CST 2011
Try this: 1) Lose the FROM before your subquery. 2) Not sure whether you need the parentheses around your subquery. Access SQL may require it, but other flavors (e.g. Oracle) don't. 3) The GROUP BY clause was part of the main query - not the subquery - in the original. Take that out. HTH, Don -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester Sent: Monday, December 12, 2011 8:18 AM To: Access Developers discussion and problem solving Subject: [AccessD] Append Query syntax error The following select query works great SELECT Count(A.PID) AS [Active Flowing Count],EngArea FROM (SELECT DISTINCT A.PID, EngArea FROM [tbl Statuses During Prior Month] AS A WHERE(A.Status In ("FL","FM","FH"))) Group by EngArea; When I tried to make it an append query I get a syntax error. I don't see the error. Maybe someone else can INSERT INTO [tbl Monthly Well Count](Count(A.PID) AS [Active Flowing Count],EngArea) FROM (SELECT DISTINCT A.PID, EngArea FROM [tbl Statuses During Prior Month] AS A WHERE(A.Status In ("FL","FM","FH"))) Group by EngArea; Thanks Chester Kaup Engineering Technician Kinder Morgan CO2 Company, LLP Office (432) 688-3797 FAX (432) 688-3799 No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com