sql group by 分組后查詢最新的一條數據


分組以后查詢最新的一條數據


$sql = "SELECT i.operating_system,
i.version_id,
i.update_time,
i.operating_system,
i.version_id,
i.version_name,
i.sdk_info,
i.sdk_name,
i.id,
i.doc_info
FROM
doc_info i
JOIN (
SELECT
operating_system,
version_id,
version_name,
sdk_info,
id,
MAX(update_time) AS update_time
FROM
doc_info
GROUP BY
operating_system,
version_id
) t ON i.operating_system = t.operating_system
AND i.version_id = t.version_id
AND i.update_time = t.update_time and

".$map."order by i.update_time desc";


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM