请说明你有这张表:
Name C1 C2
Name1 A 1
Name1 B 2
Name2 B 1
Name2 A 2
我需要的是:
Name1 B 2
Name2 B 1
我试试
select Name, max(C1), max(C2) from table
group by Name
但它不起作用, 请帮忙。
答案 0 :(得分:1)
试试这个:
Select
A.*
From [Table] A
Join (Select Name, MAX(C2) From [Table] Group By [Name]) B
On A.Name = B.Name And A.C2 = B.C2