MySQL query results on MAX() and GROUP BY
Posted: Fri Jul 22, 2005 6:58 pm
When I do this query from PHP:
$result = mysql_query("SELECT armor_key, MAX(high_bid), value_full FROM armor WHERE armor_status='2' GROUP BY high_bid DESC LIMIT 3");
I don't seem to get the data for high_bid itself... It's probably a simple solution; how do I specify that I also want to get the high_bid value? I've tried removing and replacing the GROUP BY, but when I don't use it, I get a MySQL error, and when I enter another column like value_full, I get unwanted results... Can anyone help?
$result = mysql_query("SELECT armor_key, MAX(high_bid), value_full FROM armor WHERE armor_status='2' GROUP BY high_bid DESC LIMIT 3");
I don't seem to get the data for high_bid itself... It's probably a simple solution; how do I specify that I also want to get the high_bid value? I've tried removing and replacing the GROUP BY, but when I don't use it, I get a MySQL error, and when I enter another column like value_full, I get unwanted results... Can anyone help?