That will *NEVER* work!
SELECT `tag`, `price`, MIN(`price`) AS lowest FROM expedia GROUP BY `tag`
It doesn't even make SENSE!
WHY would you get *BOTH* price AND MIN(price)???
The real problem here is that MySQL is *TOO FLEXIBLE*. That fact that it even ALLOWS you to make that query is, in my mind, a DEFICIENCY.
No other DB engine would allow it. Others would all complain that you used the field price
but then did not put it in your GROUP BY
. And if you then indeed used
SELECT tag, price, MIN(price) AS lowest FROM expedia GROUP BY tag, price
they would complain that you used the same field in an aggregate function as you used in GROUP BY.
The *RIGHT* answer, in any DB, is to get rid of price
in the query:
SELECT tag, MIN(price) AS lowest FROM expedia GROUP BY tag
and then you *PROBABLY* also want some kind of ORDER BY on that. Most likely
SELECT tag, MIN(price) AS lowest FROM expedia GROUP BY tag ORDER BY lowest
Oh...and why you think you need those back ticks all over the place, I have no idea. You only need them if the name of your field or table is a MySQL keyword *OR* if you have illegal characters in your name. Neither of which apply here.