Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

declare @NumberOfStudents int
declare @StudentsPerGroup int

set @StudentsPerGroup = 10
set @NumberOfStudents = 104

select number, ntile((@NumberOfStudents / @StudentsPerGroup)+1) over(order by number) as GroupID
from master..spt_values
where type = 'P' and
      number between 1 and 104

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results