var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: SQL and Frequency
If I have a table with a First_Name and Last_Name field, how would I
create a SQL atatement which returns the most frequent first name?
Re: SQL and Frequency
Something like this:
When you are in the query builder click the Sum button (the zigzaggy 'E'). This gives you options for grouping, summing, counting averaging etc.
SELECT TOP 1 Count(Namelist.FirstName) AS CountOfFirstName, Namelist.FirstName, Namelist.LastName
GROUP BY Namelist.FirstName, Namelist.LastName
ORDER BY Count(Namelist.FirstName) DESC;
brian, you cannot group by both first and last and still get the most frequently occurring first name
you want to group only by first name
That would explain why my test only turned up 6 'James' out of 16,000 records. They were all 'Smith'. Leave out LastName and I get 562 'James'.
Just moving a little too fast this morning,