MySQL Query - Maximum Frequency
Posted on 2010-08-16
I have a project with a table that contains information of various car models. The data schema is:
Table Name: CarModelTbl
The table currently only contains 7 records as displayed below:
I currently work out the Maximum frequency for a model which occurred the most for July 2010 and this is 2. This is calculated with the query below:
SELECT Max(A.no_count) FROM (SELECT COUNT(*) as no_count FROM CarModelTbl WHERE sDATE >= "2010-07-24" AND sDATE <="2010-07-25" Group by Model HAVING ( COUNT('Model ') > 0)) as A;
The above query works as expected - But now I have a requirement to also display the model which occurred the most and in this case it would Toyota.
Any ideas how to update the query....
Thanks in advance.