Cant seem to figure this one out...
I have a table, one of the fields is variabletype. There are several user input variable types. For example:
id | variabletype 1 | button 2 | text 3 | button 4 | link 5 | button 6 | link
I wrote some SQL to basically count the number of times each variable type is listed. I nestled that into a subquery so that I can then get the record that has the max number of instances (in this example - button).
My problem is the query only returns the max number, it does not display the actual variable type. my ideal outcome is having the variabletype display along with the max count. Any thoughts?
SELECT MAX(y.mosttested)
FROM (SELECT variabletype, COUNT(variableid) AS mosttested
FROM variable GROUP BY variabletype) y