[Code]Sql选择字段唯一值并上后面的字段
表
A B Id
--------------------------------------
1 A 1
1 B 2
2 C 3
2 D 4
3 E 5
3 F 6
选择结果:
A B Id
--------------------------------------
1 A 1
2 C 3
3 E 5
SELECT *
FROM TEST
WHERE (ID IN
(SELECT MIN(id)
FROM TEST
GROUP BY A))