Forum Moderators: open

Message Too Old, No Replies

mySQL Query help

help me get the query I need :)

         

danbhala

1:45 pm on Mar 28, 2007 (gmt 0)

10+ Year Member



Hi,

i have made a table that holds data on a users car.

for example my table looks like this

id, userid, make, model, year
-------------------------------------
1, 62, Honda, Civic, 1999
2, 68, Honda, Prelude, 2002
3, 76, Ford, Escort, 2004
4, 99, Honda, Civic, 2002
5, 67, Ford, Fiesta, 1997
6, 92, Honda, Civic, 2006
2, 68, Honda, Prelude, 1998

I'd like to query the database to find out the most popular car. So therefore the query must find the most popular instances of the make and model. So for example such query will output the 'Honda Civic'.

Any help would be greatly appreciated :)

justageek

1:53 pm on Mar 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe this - "select count as cnt, make, model from your_table group by make, model order by cnt desc"

JAG