📜  在 MySQL 连接表中使用 GROUP BY - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:55.096000             🧑  作者: Mango

代码示例1
SELECT q.* FROM (
SELECT patient . * , visit.uid AS visit_uid
FROM patient
LEFT JOIN visit ON patient.uid = visit.patient_id
ORDER BY visit_uid DESC 

) q GROUP BY q.uid ORDER BY q.visit_uid DESC 

LIMIT 0 , 10