Hi all..
I have a table -
ID
| EmpCode
| FName
| LName
| CreatedBy
| CreatedOn
|
1
| 123
| Ketan
| Jadav
| 456
| 2013-09-09
|
2
| 456
| Suresh
| Sharma
| 456
| 2013-09-09 |
3
| 876
| Lakshmi
| Rao
| 456
| 2013-09-09 |
4
| 489
| Reshma
| Gandhi
| 456
| 2013-09-09
|
I have to load this table as -
select USERS.EmpCode, USERS.FName,USERS.LName,
(SELECT CONVERT(varchar(max),a.FName )+' '+CONVERT(varchar(max),a.LName )
from TBL_USERMASTER a
where a.EmpCode=CONVERT(numeric(25,0),USERS.TeamLead))as CreatedBy,
CONVERT(VARCHAR(10),TBL_USERMASTER.CreatedOn ,103) AS CreatedOn from USERS order by TBL_USERMASTER.EmpCode desc
I get the output as -
EmpCode
| Fname
| LName
| CreatedBy
| CreatedOn
|
123
| Ketan
| Jadav
| Suresh Sharma
| 2013-09-09 |
| Suresh | Sharma | Suresh Sharma | 2013-09-09 |
876 | Lakshmi | Rao
| Suresh Sharma | 2013-09-09 |
489 | Reshma | Gandhi | Suresh Sharma | 2013-09-09 |
Now, How do I implement paging in this query using Row_Number() ??
Eg -
'select * from (select ROW_NUMBER() over (order by Table1.ID) as ROW,
Table1.Col1 , Table1.Col2, ,CONVERT(VARCHAR(10),Table1.CreatedOn ,103)
AS CreatedOn , Table1.Col3
from Table1 as Table1Rows where ROW BETWEEN 1 and 50 order byTable1.ID'
-------------
I am not able to do paging in this query.