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 |
aoriju
Posting Yak Master
156 Posts |
Posted - 2013-07-26 : 10:28:09
|
Hi all My table contains 1000 records,i need to know the total record count with the below paging querySELECT EmpName,Place FROM EmplyeeDetails ORDER BY Place OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY;How to get |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-07-26 : 10:32:52
|
If you want it with each record,SELECT EmpName,Place, count(*) over() as TotalRecordsFROM EmplyeeDetails ORDER BY PlaceOFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY; |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2013-07-28 : 10:35:18
|
ordeclare @total intset @total=(select count(*) from EmplyeeDetails)SELECT EmpName,Place, @total as total_recordsFROM EmplyeeDetails ORDER BY PlaceOFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY;MadhivananFailing to plan is Planning to fail |
|
|
|
|
|