Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Functions
WHERE Clause
HAVING Clause
GROUP BY Clause
FUNCTION: COUNT
SELECT COUNT(field) AS [expression]
FROM table
[WHERE ...]
[GROUPBY ...]
[HAVING ...]
The
COUNT
function is one of the aggregate functions that are used to calculate statistical information for a specified numeric field in a query. The other aggregate functions are:
AVG, MAX, MIN, STDEV, STDEVP, SUM, VAR, VARP
. Note that all of these functions return a single value.
The
COUNT
function simply counts how many values are in a field. Values which are
NULL
are included in the counting. If the field is just an empty set,
COUNT
returns zero.
This code finds the number of MediCare patients that were in the hospital on June 26, 2000 and stores that number into PatientCount. Note that the date format in Jet SQL is: #mm/dd/yyyy#
SELECT COUNT(Patients) AS [PatientCount]
FROM MediCarePatients
WHERE Date = #06/26/2000#
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information