标签:order bsp 分页 create rom group by over arc number
分页
SELECT TOP 页大小 *
FROM
(
SELECT ROW_NUMBER() OVER (ORDER BY id) AS RowNumber,* FROM table1
) as A
WHERE RowNumber > 页大小*(页数-1)
分组聚合
create table tb(id int, value varchar(10))
insert into tb values(1, ‘aa‘)
insert into tb values(1, ‘bb‘)
insert into tb values(2, ‘aaa‘)
insert into tb values(2, ‘bbb‘)
insert into tb values(2, ‘ccc‘)
go
select id, [value] = stuff((select ‘,‘ + [value] from tb t where id = tb.id for XML path(‘‘)) , 1 , 1 , ‘‘)
from tb
group by id
标签:order bsp 分页 create rom group by over arc number
原文地址:http://www.cnblogs.com/zsjbky/p/7016588.html