I’ve a table called dept
with dept_id
as foreign key in participants
table. Training is to be in 4 batches (A, B, C and D) the participants of the training are coming from 5 departments.
I need all the departments to be represented in each of the batches. How do I select 20 participants from each dept
per batch? So that for each batches I will have 100 participants.
NOTE: I am not looking at any specific order for the selection, I t can be random or not.
I’ve this query so far:
SELECT dept.dept_name,
participants.full_name,
participants.email,
participants.phone_number
FROM participants
JOIN dept
ON participants.dept_id = dept.dept_id
WHERE dept_name IN ( "lifestock", "fishery", "media", "foodtech", "extension" )
ORDER BY participants_id
LIMIT 20;