Select average from MySQL table with LIMIT

前端 未结 2 1851
别那么骄傲
别那么骄傲 2020-12-16 10:50

I am trying to get the average of the lowest 5 priced items, grouped by the username attached to them. However, the below query gives the average price for each user (which

2条回答
  •  清酒与你
    2020-12-16 11:10

    Simple solution below.

    Query:

    SELECT  AVG(Column_name) 
    FROM  (SELECT Column_name 
    FROM  Table
    WHERE  ColumnID < number[Limit you want] )
    

提交回复
热议问题