jeudi 7 avril 2016

Randomly selecting records and grouping(randomly partitioning rows)

Hi I have staff table and i want to assign them to different Department randomly let suppose staff table structure like this

id  staffname 
1   A    
2   B    
3   C    
4   D    
5   E    
6   F    
7   G    
8   H    
9   I  

Any Idea?? how do i select staff randomly and assign them to multiple group so that no staff will repeat in a Dept for example

Dept 1

 id  staffname 
 3   C        
 5   E    
 6   F       
 9   I

Dept 2

id  staffname 
1   A        
4   D   
7   G 

Dept 3

id  staffname 
1   A    
2   B    
8   H 

I am trying to do this in Laravel/Mysql




Aucun commentaire:

Enregistrer un commentaire