Jump to content

Clever php/SQL table sort?


delphi123

Recommended Posts

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?

 

Link to comment
https://forums.phpfreaks.com/topic/80002-clever-phpsql-table-sort/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.