SQL SERVER TUTORIAL IN DEPTH

The blog is to help users about sql server

Others

LightBlog

Breaking

Saturday 4 January 2014

Use of NTILE in sql server

create table #temp1
(
userid int
)

insert into #temp1
select 12
union all select 13
union all select 13
union all select 14
union all select 14
union all select 15
union all select 19

select * from #temp1

select userid,ntile(3) over(order by userid) as final

from #temp1





















--It randomly divides

No comments:

Post a Comment

 test