SELECT
p.*,
t.name as team_name,
st.id as tournament_id, st.subject as tournament_name, st.color,
count(distinct ey.id) as yellow,
count(distinct er.id) as red,
count(distinct er2.id) as red2,
count(distinct gp.id) as pgames
FROM management as p
left join teams as t on t.id=p.team_id
left join seasons_tournaments as st on st.season_id='12'
left join management_events as ey on ey.management_id=p.id and ey.event_type='Yellow Card' and ey.tournament_id=st.id
left join management_events as er on er.management_id=p.id and er.event_type like 'Red%' and er.tournament_id=st.id
left join management_events as er2 on er2.management_id=p.id and er2.event_type like 'Red%' and er2.tournament_id=st.id
left join games as gm
on ( gm.id=ey.game_id
or gm.id=er.game_id
or gm.id=er2.game_id ) and gm.season_id='12'
left join games as gp on (
gp.actual_team_1_management LIKE CONCAT( '%"',p.id,'":%' )
or gp.actual_team_2_management LIKE CONCAT( '%"',p.id,'":%' )
) and gp.season_id='12'
where p.team_id='144' and st.season_id='12'
group by p.id
having pgames>0
order by yellow asc, red asc, st.id asc
გუნდის წარმომადგენელთა სტატისტიკა - 2025/2026