delphi123 Posted December 3, 2007 Share Posted December 3, 2007 Ok I have a sql table like below: MakeModelSeatsPower FordTransit850 FordEscort560 BMWm3370 BMWm5590 And it's displaying in table on a webpage using a SQL query like this: $result = mysql_query ("select make, model, seats, power from $dataset $filter ORDER BY $rating_sort DESC" ); This works great, but I want to be able to have a dropdown list that'll just show the brand averages (ie 'ford' will appear once and show the average of seats (6.5) and power (55) and do the same for the other brand - so in the above example there should only be two rows that are returned from the database? Is this possible at all? Quote Link to comment Share on other sites More sharing options...
Barand Posted December 3, 2007 Share Posted December 3, 2007 SELECT make. AVG(seats) as avseat. AVG(power) as avpower FROM $dataset GROUP BY make Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.