Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
abhijeetdighe
Starting Member
24 Posts |
Posted - 2009-10-26 : 07:20:26
|
HiMy query is returning some result. I want to add one more column to this query as PageNo.Suppose if my query is returning 35 records, then PageNo column should contain 1 for records 1-10, then PageNo column should contain 2 for records 11-20, then PageNo column should contain 3 for records 21-30, and then PageNo column should contain 4 for remaining records 31-35.How to write query for this? |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2009-10-26 : 09:57:54
|
[code]create table #t (id int)declare @i intset @i = 1while @i <= 35begin insert #t values (@i) set @i = @i + 1endselect id, ceiling(id/10.0) as PageNo from #tdrop table #t[/code] |
|
|
|
|
|