【发布时间】:2016-05-24 22:48:11
【问题描述】:
我需要在两列中获取两个数字的记录。但我需要找到其中一列的最小值。并找到与该最小数字对齐的数字。
现在我有以下内容:
$sql = "SELECT ID, MIN(price) AS minPrice FROM my_table";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
echo $row["minPrice"]; // This works
echo $row["ID"]; // This is not the number that is in the record where minPrice is.
【问题讨论】:
标签: php mysql select mysqli min