I don't understand why the price range selection result is incorrect by using the HAVING Clause and the MIN() and MAX() aggregation functions together.
Here below an example:
SELECT * FROM table t
WHERE t.b_id=10
GROUP BY t.t_id
HAVING min(t.price)> 0 AND max(t.price)<16
ORDER BY t.id DESC LIMIT 100 OFFSET 0
The result shows also rows with price values higher than 16, it seems like an out of range selection. Can someone explain me why MySQL doesn't select in range?
If I remove the MIN() and MAX() then the range selection seems correct.