[AccessD] Counts of value ranges

Drew Wutka DWUTKA at Marlow.com
Thu Apr 24 09:29:07 CDT 2008


Use a subquery, and a table that holds those values:

tblRanges
MinValue
MaxValue

tblDataTable
Value

SELECT (SELECT Count(*) FROM tblDataTable WHERE Value >=T1.MinValue AND
Value <=T1.MaxValue) FROM tblRanges AS T1

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Thursday, April 24, 2008 8:44 AM
To: Access Developers discussion and problem solving; Dba-Sqlserver
Subject: [AccessD] Counts of value ranges

Guys,

Is there a way in SQL to get counts of records in value ranges:

$2,000,000+
$1 - $1.99M
$750K - $999K
$500K - $749K
$400K - $499K
$300K - $399K
$200K - $299K
$100K - $199K
<$100K
-- 
John W. Colby
www.ColbyConsulting.com
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.





More information about the AccessD mailing list