Hello All, I am confused with SQL query. I have a table called Timesheet where i have multiple transactions of different employees..like i can have 20 rows on trid=1, empid=1 and 15 rows on trid=1 ,empid=3. Now i want to fetch data from 6th row for any employee. For ex. say employee no 1,trid=1. and say it has total 20 rows. Now i want all data of this employee from 6th row..leaving first 5 row. Can anyone help me for the query ?? Regards, Jesha
Its easily done with ROW_NUMBER. Here's an example using the AdventureWorks database - you'll be able to customize the T-SQL below to match your own table schema: USE AdventureWorks; GO WITH SalesPerson AS ( SELECT ROW_NUMBER() OVER(ORDER BY LastName) RowNum, FirstName, LastName FROM Sales.vSalesPerson ) SELECT * FROM SalesPerson WHERE RowNum = 6; I hope that helps.