sql - Select average from MySQL table with LIMIT -


I am trying to get the average of the items with the least value 5, which are grouped with the user name associated with them. However, the following questions give the average value (which is definitely worth) for each user, but I just have to return one answer.

  The price of WHERE from the selection (price) table & gt; '0' and amp; Amp; Item_id = '$ id' group user name ORDER by ASC limit 5  

I think This is what you are following:

  SELECT AVG (items.price) (Select from T.I.C. table where TPICs & gt ; 0 'and t.item_id =' $ id 'ORDER BY t.price LIMIT 5) Item  

This will return an average of 5 lowest prices - one answer


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -