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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.