I have the following query
$query = "SELECT * FROM used ".$conditionString." ORDER BY id DESC LIMIT $offset, $rec_limit";
But now I want to know also the average price of the returned rows
AVG(Price) AS PriceAverage
How to do this?
this should work for you:
$query = "SELECT *,AVG(Price) FROM used ".$conditionString." ORDER BY id DESC
GROUP BY id WITH ROLLUP
LIMIT $offset, $rec_limit";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.