I am developing a holiday rentals site and each home has multiple rates. So I have a table homes and a table rates. When I fetch the using this sql
SELECT *
FROM homes
INNER JOIN rates ON rates.home_id = homes.id
GROUP BY homes.id
ORDER BY rates.price ASC
the results are not correct. I get mixed prices and from minimum to maximum. I think the problem is that there are mupltiple rates for each home. So how can I find the minimum rate and sort by it?
1 Answer