Hi There,I need to group up the records randomly into ‘n’ number of batches. That can be done by NTILE, but I want group up similar records in single group.Say for example, following is the list of records I have in my table which I want to group into 5 batchesA123A124A124A123A127After Ntile I will get the below,[img]http://www.sqlservercentral.com/Forums/Attachment17459.aspx[/img]Desired output is, Need output like Ntile but all same id should reside in single batch[img]http://www.sqlservercentral.com/Forums/Attachment17460.aspx[/img]Even if I n=5, maximum possibility of batches are 3 only.Thanks in advance
↧