|
Prev: select rowcount per group before value in group = null
Next: Go to www.dorlex.com to get your replica handbags
From: Aditya on 22 Jul 2008 11:52 Hi Ken, You can get the total record count by using the OVER keyword. For the code you provided, make changes like below. With Cust AS ( SELECT CustomerID, CompanyName, ROW_NUMBER() OVER (order by CompanyName) as RowNumber, COUNT(*) OVER () As TotalCount FROM Customers where Country in ('US', 'CN')) select * from Cust Where RowNumber Between 20 and 30 Note that I added the following line of code to your Code. COUNT(*) OVER () As TotalCount The Column TotalCount which now appears in each row will give you the Total Number of Records which you have to handle in your application. Thanks, Aditya. |