Just conditional aggregation:
select date, count(*) as cnt_train,
sum(condition1 > 0) as cnt_condition1,
sum(condition2) as cnt_condition2
from t
group by date;
EDIT:
This uses the MySQL extension that treats boolean values as numbers in a number context, with 1
for true and 0
for false. This works for any boolean expression, so you can use more complex ones, such as:
sum(condition1 > 0 and condition2) as cnt_condition1_and_condition2
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…