?? 求同一值的最小id.txt
字號:
id fid
1 2
2 2
3 2
4 2
5 3
6 3
7 3
8 3
我想返回這樣:
id fid
1 2
5 3
/*測試數(shù)據(jù)*/
declare @tab table(id int,fid int)
insert into @tab select 1,2
union all select 2,2
union all select 3,2
union all select 4,2
union all select 5,3
union all select 6,3
union all select 7,3
union all select 8,3
select min(id)as id, b.fid from @tab a
inner join (select distinct(fid) from @tab as fid) b
on a.fid=b.fid
group by b.fid
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -