If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Calculating the mode value in a query?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-22-05, 12:49
daroy5 daroy5 is offline
Registered User
 
Join Date: Jan 2005
Posts: 15
Calculating the mode value in a query?

In a summary query, I need to return the value that shows up the greatest number of times in a certain column of a table. Is there a function built in to Access or an easy way to perform this, or do I have to make my own function to handle this?
Reply With Quote
  #2 (permalink)  
Old 02-23-05, 13:03
MikeTheBike MikeTheBike is offline
Registered User
 
Join Date: Apr 2004
Location: Derbyshire, UK
Posts: 656
Hi

I think this query this will do what you want

Code:
SELECT TOP 1 Table1.Data
FROM Table1
GROUP BY Table1.Data
ORDER BY Count(Table1.Data) DESC;
I Think (have go to go), but this will return the item that occurres most in the 'Data' field in Table1 !

Hope that is wat you hat in find ?

MTB
Reply With Quote
  #3 (permalink)  
Old 02-24-05, 13:29
daroy5 daroy5 is offline
Registered User
 
Join Date: Jan 2005
Posts: 15
This looks good - I will embed this in my query and see what it spits out. Thanks so much for your reponse; will keep you posted on the result!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On