排序精典,不得不看~
来源:互联网 发布:淘宝信用贷款10万 编辑:程序博客网 时间:2024/04/30 23:50
declare @t table(id int,Uid int,Str varchar(4))
insert into @t select 1,5,'aaa'
insert into @t select 2,5,'bbb'
insert into @t select 3,5,'ccc'
insert into @t select 4,6,'ddd'
insert into @t select 5,6,'eee'
insert into @t select 6,8,'ggg'
insert into @t select 7,8,'ttt'
insert into @t select 8,2,'uuu'
insert into @t select 9,2,'hhh'
select a.* from @t a order by (select count(*) from @t where Uid=a.Uid and id<=a.id),uid
/*
id Uid Str
----------- ----------- ----
8 2 uuu
1 5 aaa
4 6 ddd
6 8 ggg
9 2 hhh
2 5 bbb
5 6 eee
7 8 ttt
3 5 ccc
*/
- 排序精典,不得不看~
- 不得不看
- 不得不看的网站
- 不得不看的文章
- 不得不看的网站
- typedef 不得不看
- Fedora10 安装技术不得不看!
- .NET不得不看的网站
- 经典英语口语,不得不看(推荐)
- 开发人员不得不看的网站
- 不得不看的黑客工具集
- 不得不看的网站收藏
- 会计人员不得不看的备忘录
- 应届毕业生不得不看的东西
- Web开发入门不得不看
- Web开发入门不得不看
- Web开发入门不得不看
- Web开发入门不得不看
- I/O Streams的运用
- 马坦故事连载一
- 让IE支持自己的协议
- 更新后的题目
- 千年的日子
- 排序精典,不得不看~
- Asp.net动态生成html页面
- ASP操作Excel技术总结
- 在asp.net中如何调用自定义类的方法?
- 问情
- 发现三本不错的讲解数据存储的书
- 两个小函数让你的ASP程序对SQL注入免疫
- 总结近来说到的-----American slang
- SQL Server涉及到的数据仓库基本概念