;with Rohi as
(
select
GlobalCodeName ,sortorder,GlobalCodeCategoryID,
ROW_NUMBER() OVER (PARTITION BY GlobalCodeCategoryID order by GlobalCodeCategoryID ) AS 'RowNum'
from GlobalCodes
)
select * from Rohi where RowNum <=5
select (max(SortOrder)) + 1 from GlobalCodes where GlobalCodeCategoryID=13
--pass the date
select Isnull(max(SortOrder),0) + 1 from GlobalCodes where GlobalCodeCategoryID=13
(
select
GlobalCodeName ,sortorder,GlobalCodeCategoryID,
ROW_NUMBER() OVER (PARTITION BY GlobalCodeCategoryID order by GlobalCodeCategoryID ) AS 'RowNum'
from GlobalCodes
)
select * from Rohi where RowNum <=5
select (max(SortOrder)) + 1 from GlobalCodes where GlobalCodeCategoryID=13
--pass the date
select Isnull(max(SortOrder),0) + 1 from GlobalCodes where GlobalCodeCategoryID=13
No comments:
Post a Comment