select min(h.price) as minPrice, max(h.price) as maxPrice, avg(h.price) as avgPrice, date_format(h.priceDate, '%Y-%m') as dt from db_price_community_history h where h.priceDate between :startDate and :endDate AND h.houses=:houses group by date_format(h.priceDate, '%Y-%m') order by dt