SELECT State, County, Count(County) As CountyCount
FROM MyTable
GROUP BY State, County

John Viescas, author
"Building Microsoft Access Applications"
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/

> -----Original Message-----
> From: LTPortella [mailto:[EMAIL PROTECTED] 
> Sent: Friday, March 18, 2005 11:17 PM
> To: ms_access@yahoogroups.com
> Subject: RE: [ms_access] Access and VBA
> 
> 
> 
> John
> Very neat. What if Bill wanted to know the number of times 
> that any one
> county occurs for a given state? Can it be done easily? Best regards
> 
> -----Original Message-----
> From: John Viescas [mailto:[EMAIL PROTECTED] 
> Sent: Friday, March 18, 2005 3:00 PM
> To: ms_access@yahoogroups.com
> Subject: RE: [ms_access] Access and VBA
> 
> 
> Bill-
> 
> SELECT DISTINCT State, County
> FROM MyTable
> 
> John Viescas, author
> "Building Microsoft Access Applications"
> "Microsoft Office Access 2003 Inside Out"
> "Running Microsoft Access 2000"
> "SQL Queries for Mere Mortals"
> http://www.viescas.com/
> 
> > -----Original Message-----
> > From: bill0054 [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, March 18, 2005 1:34 PM
> > To: ms_access@yahoogroups.com
> > Subject: [ms_access] Access and VBA
> > 
> > 
> > 
> > 
> > Hi all,
> > 
> > Here is what I'm trying to do. I have a query and part of 
> it has two 
> > fields. The first lists states and the second lists 
> counties. I want 
> > to make a procedure that will select only one county( there are 
> > duplicates ) for each state and create a list of states with no 
> > repeated counties.I'm not sure where to do this in Access or how. 
> > Some have suggested doing it in conjunction with VBA.
> > 
> > Thanks for any help,
> > 
> > Bill Ellis
> > 
> > 
> > 
> > 
> > 
> >  
> > Yahoo! Groups Links
> > 
> > 
> > 
> >  
> > 
> > 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to