Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要获取每组 UID 中的最大 ID。
ID UID 23 1 24 1 25 2 26 2
会给:
ID UID 24 1 26 2
如何获得每组中的最大行数?
使用MAX-operator 和 group by UID。
MAX
UID
SELECT MAX(t.ID), t.UID FROM yourtable AS t GROUP BY t.UID;