Heenan, Lambert
Lambert.Heenan at chartisinsurance.com
Mon Sep 13 10:04:17 CDT 2010
Perhaps... SELECT dbo_DSS_StatusChanges.Status, Nz(Count(dbo_DSS_StatusChanges.Status),0) AS [Active CO2 Injector Count] FROM [qry Active... Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester Sent: Monday, September 13, 2010 10:47 AM To: Access Developers discussion and problem solving Subject: [AccessD] Count in a query How can I get this query to return a count of 0 if there are no records returned? SELECT dbo_DSS_StatusChanges.Status, Count(dbo_DSS_StatusChanges.Status) AS [Active CO2 Injector Count] FROM [qry Active Injectors Max Status Date] INNER JOIN dbo_DSS_StatusChanges ON ([qry Active Injectors Max Status Date].MaxOfStatusDate = dbo_DSS_StatusChanges.StatusDate) AND ([qry Active Injectors Max Status Date].Well_Number = dbo_DSS_StatusChanges.Completion_Name) GROUP BY dbo_DSS_StatusChanges.Status HAVING (((dbo_DSS_StatusChanges.Status)="CI")); 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