John W. Colby
jwcolby at colbyconsulting.com
Sat Feb 12 07:27:30 CST 2005
SELECT DISTINCT State from tblXXXX John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Erbach Sent: Saturday, February 12, 2005 7:35 AM To: Access Developers discussion and problem solving Subject: [AccessD] A2000: Am I blind? (swe) Dear Group, Of course, I can do this with TWO queries. I'm just wondering if there's something vital I'm missing that can cause it to be done in one. I have address data in a table. Many different states. I want to COUNT the number of unique states. That is, if I have 5,000 addresses I want to see how many states they come from. If I do something like this: SELECT Count(State) AS CountOfState FROM Addresses I get the number 5,000. Making it SELECT DISTINCT doesn't work. If I do this: SELECT State, Count(State) AS CountOfState FROM Addresses GROUP BY State I get a list of the states with how many occurrences there are for each. But can I not use one query to get me the count of all the different states there are? Simon says, you may laugh. Regards, Steve Erbach Scientific Marketing Neenah, WI www.swerbach.com Security Page: www.swerbach.com/security -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com