A seating chart, a student table
Seating chart:
ID Zid UserID
Student table:
UserID Cityid
Now I want to randomly write the student table students to the seating chart, seating chart Zid is a 2 digit seat number
For example, the student table has 20 students, of which 5 cities Cityid the same, 5 Cityid the same student to stagger 5 digits in the seating table Zid so, how can it be achieved?
A PHP for testing purposes to prevent the city Cityid the same student seat.
Thank you, first!
Reply to discussion (solution)
Who is the Master guide, thank you!
Stagger 5 bits is the interval between 5 and above, or the interval 4 can be?
If it is the former, then 5 students of the same Cityid will not be able to appear in the classroom of 20 people at the same time
Thank you upstairs friend reply, this is just hypothesis, classroom number may be 100 people
Who is the Master guide, thank you!