SELECT tr_training.training_year, COUNT(tr_training_register.confirm)
FROM (
tr_training_register
INNER JOIN tr_training ON tr_training_register.confirm = tr_training.id
)
WHERE training_year
AND confirm =1
OR confirm =2
GROUP BY training_year, confirm
SELECT tr_training.training_year, COUNT(tr_training_register.confirm)
FROM (
tr_training_register
INNER JOIN tr_training ON tr_training_register.confirm = tr_training.id
)
WHERE training_year = '????'
AND confirm =1
OR confirm =2
GROUP BY training_year, confirm