【发布时间】:2020-08-03 17:03:59
【问题描述】:
我只想要 'yearLevel' 上的 SELECT DISTINCT 语句(因为我不想只在 yearLevel 上出现任何重复)
image of data displayed on screen
例如,我只想要表中的一条 'yearLevel' 12 记录,并且它是具有最低 'totalSeconds' 的记录
code
$sql = "SELECT firstName, lastName, yearLevel, totalSeconds
FROM studentInformation
JOIN record
ON studentInformation.studentId = record.student_Id
ORDER BY totalSeconds ASC
LIMIT 1 ";
这样可以吗-
$sql = "SELECT firstName, lastName, DISTINCT yearLevel, totalSeconds
FROM studentInformation
JOIN record
ON studentInformation.studentId = record.student_Id
ORDER BY totalSeconds ASC
LIMIT 1 ";
【问题讨论】:
标签: php mysql select phpmyadmin distinct