表中的数据为: ID aa
1 1
2 1
3 1
4 2
5 2
6 3
6 3............. 依次类推,我只要aa=1的一条,aa=2的一条,aa=3的一条,依次类推,用TSQL语句应该怎么写,在线等,解决立刻送分
1 1
2 1
3 1
4 2
5 2
6 3
6 3............. 依次类推,我只要aa=1的一条,aa=2的一条,aa=3的一条,依次类推,用TSQL语句应该怎么写,在线等,解决立刻送分
解决方案 »
- Sandy945 补分
- bool变量赋值为true,输出却为False,为什么?
- 为什么ie状态栏一直显示正在下载图片XXXX
- IE显示(.eml文件)问题!请大家帮助解决!谢谢
- asp.net gridview中 有下一级信息如何做删除限制?
- 程序员就这样没有前途吗?
- 一台服务器,一个固定IP,怎么同时做多个域名的WEB服务器
- 谁买了《.NET系统架构与开发》―深入剖析.NET系统技术内幕 的 书?如何?
- 大学里的电子阅览室一般建在哪个部门?
- GridView_SelectedIndexChanged,SelectedIndexChanged事件点击没反应啊
- 我在WIN7中修改了 Microsoft.NET\Framework\v2.0.50727\config\machine.config,但是出现无法保存的现象·
- ASP.NET数据集(XSD)调用
group by aa
group by aa
tb t where not exists(select 1 from tb where t.id>id and t.aa=aa)--try
tb t where not exists(select 1 from tb where t.id>id and t.aa=aa)
insert into @t values( 1,1)
insert into @t values( 2,1)
insert into @t values( 3,1)
insert into @t values( 4,2)
insert into @t values( 5,2)
insert into @t values( 6,3)
insert into @t values( 6,3)
insert into @t values( 6,5)
select aa , min([id]) as [id] from @t group by aa having Count(*) >=2
group by aa怎么不对,你测试下不就知道了