View Full Version : Writing a query to find the most popular tutor and get this as a value


kate10123
08-27-2008, 12:27 AM
Hi there,

I have two tables, tbl_tutorial and tbl_tutor. I am looking to find which tutor has given the most tutorials so I know these two tables will need to be in the query design.

I want the output to be something like Jane Smith. So for the tutor with the most tutorials to be the output the query so I can use this in a textbox.

Is such possible?

The unique count of how many tutorials comes from the unique key TutorialNo.

DCrake
08-27-2008, 01:31 AM
Create a query from the tutorial table and group by tutor, count tutorid, sort descending

kate10123
08-27-2008, 01:42 AM
Thanks for replying. That is a good way of breaking down how many tutorials each tutor has given but how can I compare these results and only display the one with the highest number?

DCrake
08-27-2008, 01:57 AM
Click on the top grey pane of the query in design mode and select properties.

Then select Top 1

It's all a case of what you want to do with this answer and how you want to present it.

If you save this query as qryTutorTotals and use a DLookup based on a tutor id you can find the answer for any tutor

kate10123
08-27-2008, 02:07 AM
Thanks it worked great!