MySQL Forums
Forum List  »  Newbie

Select 5 cheapest vehicles
Posted by: Frankl Lennon
Date: August 15, 2017 08:30AM

I have a database of 750 vehicles, I would like to run a query where I select no more than 5 of cheapest vehicles for each make & model and include those in my results.

My table fields are fldYear, fldMake, fldModel, fldRetail etc.

For example I would like the output to include the 5 cheapest Dodge 200 vehicles from 25 in total, the 5 cheapest Honda Accords from 30 in total, the 5 cheapest Jeep Cherokees from 10 in total, and if there only 2 Volkswagon Jettas, to include them as well. In the above example my output would have a total of 17 records.

I have played around with Sorts and Group By but I can't seem to get the desired output.

Any help would be much appreciated.

Thank in Advance

Options: ReplyQuote


Subject
Written By
Posted
Select 5 cheapest vehicles
August 15, 2017 08:30AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.