我的客户希望以这样的方式显示行:Name应该在组中,但是按升序传输日期。
$sql = "select staff.Name, staff.Gender, transferHistory.transferDate from
staff inner join (transferHistory) on (transferHistory.StaffID=staff.StaffID)
ORDER by transferHistory.transferDate ASC GROUP by staff.Name";
答案 0 :(得分:0)
首先,语法不正确,首先必须按所需的列进行分组,在本例中为名称,最后必须对结果进行排序......所以代码为:
$sql = "select staff.Name, staff.Gender, transferHistory.transferDate from
staff inner join (transferHistory) on (transferHistory.StaffID=staff.StaffID)
GROUP by staff.Name ORDER by transferHistory.transferDate ASC";