Arizona Diamondbacks vs. Philadelphia Phillies: Head-to-Head Reg Season and Playoffs Stats Comparison
--------------------------------------
header_comp
WITH
t1 AS (
SELECT team_id, SUM(win AND type="reg") as rsw, SUM(loss AND type="reg") as rsl, SUM(tie AND type="reg") as rst, SUM(win AND type="post") as pow, SUM(loss AND type="post") as pol
FROM sup_team_games
JOIN sup_games USING (game_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE (team_id=?)
AND opp_team_id=?
),
t2 AS (
SELECT team_id, SUM(win AND type="reg") as rsw, SUM(loss AND type="reg") as rsl, SUM(tie AND type="reg") as rst, SUM(win AND type="post") as pow, SUM(loss AND type="post") as pol
FROM sup_team_games
JOIN sup_games USING (game_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE (team_id=?)
AND opp_team_id=?
)
SELECT team_id, rs_wins, rs_losses, rs_ties, po_wins, po_losses, SUM(games) AS games, SUM(wins) AS wins, SUM(losses) AS losses, SUM(b_r)/SUM(b_games) as team_runs_pg_csk, ROUND(SUM(b_r)/SUM(b_games),1) AS team_runs_pg, SUM(p_r)/SUM(p_g) as team_ra_pg_csk, ROUND(SUM(p_r)/SUM(p_g),1) AS team_ra_pg, SUM(is_playoff_team) AS is_playoff_team, SUM(is_champion_league) AS is_champion_league, SUM(is_champion_ws) AS is_champion_ws
FROM sup_team_seasons as ts
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
LEFT JOIN (SELECT t1.team_id, t1.rsw as rs_wins, t1.rsl as rs_losses, t1.rst as rs_ties, t1.pow as po_wins, t1.pol as po_losses FROM t1
UNION SELECT t2.team_id, t2.rsw as rs_wins, t2.rsl as rs_losses, t2.rst as rs_ties, t2.pow as po_wins, t2.pol as po_losses
FROM t2) as xxx USING (team_id)
WHERE ((team_id=?) OR (team_id=?))
AND type="reg"
GROUP BY team_id
ORDER BY team_id
SQL PARAMS -- $VAR1 = [
'ARI',
'PHI',
'PHI',
'ARI',
'ARI',
'PHI'
];
--------------------------------------
h2h_gamelogs
Page Setup Time: 0.00085 seconds
SELECT IF(away_team_id="ARI","@","") as loc, IF(away_team_id="ARI",away_score,home_score) as team1_score, IF(away_team_id="PHI",away_score,home_score) as team2_score, game_id, CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, game_id, sup_games.link as game_link, sup_venue_seasons.name as venue_name, city as venue_city, outs_played as overtimes_csk, IF( scheduled_innings != 9 OR outs_played < 6*IFNULL(scheduled_innings,9)-3 OR outs_played > 6*IFNULL(scheduled_innings,9), CONCAT(CEIL(outs_played / 6), " inn."), "" ) as overtimes
FROM sup_games
JOIN (SELECT game_id, year_id, comp_id, phase_id, team_id as away_team_id, opp_team_id, opp_comp_id, opp_phase_id, team_game_num_season, home_away_neutral FROM sup_team_games) as tg USING (game_id, away_team_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
LEFT JOIN sup_venues USING (venue_id)
LEFT JOIN sup_venue_seasons USING (venue_id, year_id)
WHERE ((away_team_id=? AND home_team_id=?) OR (away_team_id=? AND home_team_id=?))
AND home_score IS NOT NULL
AND type="reg"
ORDER BY date DESC LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'ARI',
'PHI',
'PHI',
'ARI'
];
Query Time: 0.06 seconds
SELECT IF(away_team_id="ARI","@","") as loc, IF(away_team_id="ARI",away_score,home_score) as team1_score, IF(away_team_id="PHI",away_score,home_score) as team2_score, game_id, CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, game_id, sup_games.link as game_link, sup_venue_seasons.name as venue_name, city as venue_city, outs_played as overtimes_csk, IF( scheduled_innings != 9 OR outs_played < 6*IFNULL(scheduled_innings,9)-3 OR outs_played > 6*IFNULL(scheduled_innings,9), CONCAT(CEIL(outs_played / 6), " inn."), "" ) as overtimes
FROM sup_games
JOIN (SELECT game_id, year_id, comp_id, phase_id, team_id as away_team_id, opp_team_id, opp_comp_id, opp_phase_id, team_game_num_season, home_away_neutral FROM sup_team_games) as tg USING (game_id, away_team_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
LEFT JOIN sup_venues USING (venue_id)
LEFT JOIN sup_venue_seasons USING (venue_id, year_id)
WHERE ((away_team_id=? AND home_team_id=?) OR (away_team_id=? AND home_team_id=?))
AND home_score IS NOT NULL
AND type="post"
ORDER BY date DESC LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'ARI',
'PHI',
'PHI',
'ARI'
];
Query Time: 0.06 seconds
Table Build Time: 0.04 seconds
Table Build Time: 0.04 seconds
--------------------------------------
h2h_records
Page Setup Time: 0.00064 seconds
WITH
tr1 AS (
SELECT year_id, comp_id, COUNT(*) AS games, SUM(win=1) AS wins, SUM(loss=1) AS losses, SUM(b_r) AS b_r, SUM(p_r) AS p_r
FROM sup_team_games
JOIN sup_games USING (game_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE (team_id=?)
AND opp_team_id=?
AND type="reg"
GROUP BY year_id
),
tr2 AS (
SELECT year_id, comp_id, COUNT(*) AS games, SUM(win=1) AS wins, SUM(loss=1) AS losses, SUM(b_r) AS b_r, SUM(p_r) AS p_r
FROM sup_team_games
JOIN sup_games USING (game_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE (team_id=?)
AND opp_team_id=?
AND type="reg"
GROUP BY year_id
)
SELECT year_id as year_id_csk, year_id as year_id, tr1.comp_id, tr1.games AS tr1_games, tr2.games AS tr2_games, tr1.wins AS tr1_wins, tr2.wins AS tr2_wins, tr1.losses AS tr1_losses, tr2.losses AS tr2_losses, tr1.b_r AS tr1_b_r, tr2.b_r AS tr2_b_r, tr1.p_r AS tr1_p_r, tr2.p_r AS tr2_p_r
FROM tr1
JOIN tr2 USING (year_id)
WHERE 1
GROUP BY year_id
ORDER BY year_id
SQL PARAMS -- $VAR1 = [
'ARI',
'PHI',
'PHI',
'ARI'
];
Query Time: 0.07 seconds
WITH
tr1 AS (
SELECT year_id, comp_id, COUNT(*) AS games, SUM(win=1) AS wins, SUM(loss=1) AS losses, SUM(b_r) AS b_r, SUM(p_r) AS p_r
FROM sup_team_games
JOIN sup_games USING (game_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE (team_id=?)
AND opp_team_id=?
AND type="post"
GROUP BY year_id
),
tr2 AS (
SELECT year_id, comp_id, COUNT(*) AS games, SUM(win=1) AS wins, SUM(loss=1) AS losses, SUM(b_r) AS b_r, SUM(p_r) AS p_r
FROM sup_team_games
JOIN sup_games USING (game_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE (team_id=?)
AND opp_team_id=?
AND type="post"
GROUP BY year_id
)
SELECT year_id as year_id_csk, year_id as year_id, tr1.comp_id, tr1.games AS tr1_games, tr2.games AS tr2_games, tr1.wins AS tr1_wins, tr2.wins AS tr2_wins, tr1.losses AS tr1_losses, tr2.losses AS tr2_losses, tr1.b_r AS tr1_b_r, tr2.b_r AS tr2_b_r, tr1.p_r AS tr1_p_r, tr2.p_r AS tr2_p_r
FROM tr1
JOIN tr2 USING (year_id)
WHERE 1
GROUP BY year_id
ORDER BY year_id
SQL PARAMS -- $VAR1 = [
'ARI',
'PHI',
'PHI',
'ARI'
];
Query Time: 0.06 seconds
Table Build Time: 0.05 seconds
Table Build Time: 0.03 seconds
--------------------------------------
h2h_sum
Page Setup Time: 0.00120 seconds
WITH
t1gms AS (
SELECT game_id
FROM sup_team_games
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE (team_id=?)
AND type="reg"
),
t2gms AS (
SELECT game_id
FROM sup_team_games
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE (team_id=?)
AND type="reg"
)
SELECT (SELECT name_abbr FROM sup_team_seasons WHERE team_id=st.team_id AND sup_team_seasons.year_id=MAX(st.year_id) LIMIT 1) as franch_abbr, team_id, MIN(year_id) as year_min, MAX(year_id) as year_max, SUM(win=1) AS wins, SUM(loss=1) AS losses, SUM(win)/(SUM(win+loss)) as team_win_loss_perc_csk, TRIM(LEADING '0' FROM ROUND(SUM(win)/(SUM(win+loss)),3)) AS team_win_loss_perc, SUM(p_sho) AS p_sho, COUNT(*) AS games, SUM(b_r) AS b_r, SUM(b_h) AS b_h, SUM(b_doubles) AS b_doubles, SUM(b_triples) AS b_triples, SUM(b_hr) AS b_hr, SUM(b_sb) AS b_sb, IF(SUM(b_ab), SUM(b_h) / SUM(b_ab), NULL) as b_batting_avg_csk, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab), SUM(b_h) / SUM(b_ab), NULL),3)) AS b_batting_avg, IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) as b_onbase_perc_csk, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL),3)) AS b_onbase_perc, IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL) as b_slugging_perc_csk, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL),3)) AS b_slugging_perc, IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL) as b_onbase_plus_slugging_csk, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL),3)) AS b_onbase_plus_slugging
FROM sup_team_games as st
JOIN sup_games USING (game_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
JOIN t1gms USING (game_id)
JOIN t2gms USING (game_id)
WHERE home_score IS NOT NULL
GROUP BY team_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'ARI',
'PHI'
];
Query Time: 0.08 seconds
WITH
t1gms AS (
SELECT game_id
FROM sup_team_games
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE (team_id=?)
AND type="post"
),
t2gms AS (
SELECT game_id
FROM sup_team_games
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE (team_id=?)
AND type="post"
)
SELECT (SELECT name_abbr FROM sup_team_seasons WHERE team_id=st.team_id AND sup_team_seasons.year_id=MAX(st.year_id) LIMIT 1) as franch_abbr, team_id, MIN(year_id) as year_min, MAX(year_id) as year_max, SUM(win=1) AS wins, SUM(loss=1) AS losses, SUM(win)/(SUM(win+loss)) as team_win_loss_perc_csk, TRIM(LEADING '0' FROM ROUND(SUM(win)/(SUM(win+loss)),3)) AS team_win_loss_perc, SUM(p_sho) AS p_sho, COUNT(*) AS games, SUM(b_r) AS b_r, SUM(b_h) AS b_h, SUM(b_doubles) AS b_doubles, SUM(b_triples) AS b_triples, SUM(b_hr) AS b_hr, SUM(b_sb) AS b_sb, IF(SUM(b_ab), SUM(b_h) / SUM(b_ab), NULL) as b_batting_avg_csk, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab), SUM(b_h) / SUM(b_ab), NULL),3)) AS b_batting_avg, IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) as b_onbase_perc_csk, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL),3)) AS b_onbase_perc, IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL) as b_slugging_perc_csk, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL),3)) AS b_slugging_perc, IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL) as b_onbase_plus_slugging_csk, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL),3)) AS b_onbase_plus_slugging
FROM sup_team_games as st
JOIN sup_games USING (game_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
JOIN t1gms USING (game_id)
JOIN t2gms USING (game_id)
WHERE home_score IS NOT NULL
GROUP BY team_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'ARI',
'PHI'
];
Query Time: 0.03 seconds
Table Build Time: 0.04 seconds
Table Build Time: 0.04 seconds
--------------------------------------
overall_sum_bat
Page Setup Time: 0.00205 seconds
SELECT (SELECT name_abbr FROM sup_team_seasons WHERE team_id=st.team_id AND sup_team_seasons.year_id=MAX(st.year_id) LIMIT 1) as franch_abbr, team_id, MIN(year_id) as year_min, MAX(year_id) as year_max, SUM(wins IS NULL) as wins_incomplete, SUM(wins) AS wins, SUM(losses IS NULL) as losses_incomplete, SUM(losses) AS losses, NULL as games_incomplete, SUM(games) AS games, NULL as b_games_incomplete, SUM(b_games) AS b_games, SUM(b_pa IS NULL) as b_pa_incomplete, SUM(b_pa) AS b_pa, SUM(b_ab IS NULL) as b_ab_incomplete, SUM(b_ab) AS b_ab, SUM(b_r IS NULL) as b_r_incomplete, SUM(b_r) AS b_r, SUM(b_h IS NULL) as b_h_incomplete, SUM(b_h) AS b_h, SUM(b_doubles IS NULL) as b_doubles_incomplete, SUM(b_doubles) AS b_doubles, SUM(b_triples IS NULL) as b_triples_incomplete, SUM(b_triples) AS b_triples, SUM(b_hr IS NULL) as b_hr_incomplete, SUM(b_hr) AS b_hr, SUM(b_rbi IS NULL) as b_rbi_incomplete, SUM(b_rbi) AS b_rbi, SUM(b_sb IS NULL) as b_sb_incomplete, SUM(b_sb) AS b_sb, SUM(b_cs IS NULL) as b_cs_incomplete, SUM(b_cs) AS b_cs, SUM(b_bb IS NULL) as b_bb_incomplete, SUM(b_bb) AS b_bb, SUM(b_so IS NULL) as b_so_incomplete, SUM(b_so) AS b_so, IF(SUM(b_ab), SUM(b_h) / SUM(b_ab), NULL) as b_batting_avg_csk, SUM(b_h IS NULL)+SUM(b_ab IS NULL) as b_batting_avg_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab), SUM(b_h) / SUM(b_ab), NULL),3)) AS b_batting_avg, IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) as b_onbase_perc_csk, 0 as b_onbase_perc_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL),3)) AS b_onbase_perc, IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL) as b_slugging_perc_csk, SUM(b_hr IS NULL)+SUM(b_triples IS NULL)+SUM(b_h IS NULL)+SUM(b_doubles IS NULL)+SUM(b_ab IS NULL) as b_slugging_perc_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL),3)) AS b_slugging_perc, IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL) as b_onbase_plus_slugging_csk, 0 as b_onbase_plus_slugging_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL),3)) AS b_onbase_plus_slugging, SUM(b_tb IS NULL) as b_tb_incomplete, SUM(b_tb) AS b_tb, SUM(b_gidp IS NULL) as b_gidp_incomplete, SUM(b_gidp) AS b_gidp, SUM(b_hbp IS NULL) as b_hbp_incomplete, SUM(b_hbp) AS b_hbp, SUM(b_sh IS NULL) as b_sh_incomplete, SUM(b_sh) AS b_sh, SUM(b_sf IS NULL) as b_sf_incomplete, SUM(b_sf) AS b_sf, SUM(b_ibb IS NULL) as b_ibb_incomplete, SUM(b_ibb) AS b_ibb
FROM sup_team_seasons as st
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE ((team_id=?) OR (team_id=?))
AND type="reg"
GROUP BY team_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'ARI',
'PHI'
];
Query Time: 0.01 seconds
SELECT (SELECT name_abbr FROM sup_team_seasons WHERE team_id=st.team_id AND sup_team_seasons.year_id=MAX(st.year_id) LIMIT 1) as franch_abbr, team_id, MIN(year_id) as year_min, MAX(year_id) as year_max, SUM(wins IS NULL) as wins_incomplete, SUM(wins) AS wins, SUM(losses IS NULL) as losses_incomplete, SUM(losses) AS losses, NULL as games_incomplete, SUM(games) AS games, NULL as b_games_incomplete, SUM(b_games) AS b_games, SUM(b_pa IS NULL) as b_pa_incomplete, SUM(b_pa) AS b_pa, SUM(b_ab IS NULL) as b_ab_incomplete, SUM(b_ab) AS b_ab, SUM(b_r IS NULL) as b_r_incomplete, SUM(b_r) AS b_r, SUM(b_h IS NULL) as b_h_incomplete, SUM(b_h) AS b_h, SUM(b_doubles IS NULL) as b_doubles_incomplete, SUM(b_doubles) AS b_doubles, SUM(b_triples IS NULL) as b_triples_incomplete, SUM(b_triples) AS b_triples, SUM(b_hr IS NULL) as b_hr_incomplete, SUM(b_hr) AS b_hr, SUM(b_rbi IS NULL) as b_rbi_incomplete, SUM(b_rbi) AS b_rbi, SUM(b_sb IS NULL) as b_sb_incomplete, SUM(b_sb) AS b_sb, SUM(b_cs IS NULL) as b_cs_incomplete, SUM(b_cs) AS b_cs, SUM(b_bb IS NULL) as b_bb_incomplete, SUM(b_bb) AS b_bb, SUM(b_so IS NULL) as b_so_incomplete, SUM(b_so) AS b_so, IF(SUM(b_ab), SUM(b_h) / SUM(b_ab), NULL) as b_batting_avg_csk, SUM(b_h IS NULL)+SUM(b_ab IS NULL) as b_batting_avg_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab), SUM(b_h) / SUM(b_ab), NULL),3)) AS b_batting_avg, IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) as b_onbase_perc_csk, 0 as b_onbase_perc_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL),3)) AS b_onbase_perc, IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL) as b_slugging_perc_csk, SUM(b_hr IS NULL)+SUM(b_triples IS NULL)+SUM(b_h IS NULL)+SUM(b_doubles IS NULL)+SUM(b_ab IS NULL) as b_slugging_perc_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL),3)) AS b_slugging_perc, IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL) as b_onbase_plus_slugging_csk, 0 as b_onbase_plus_slugging_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / SUM(b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(SUM(b_ab), SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab), NULL),3)) AS b_onbase_plus_slugging, SUM(b_tb IS NULL) as b_tb_incomplete, SUM(b_tb) AS b_tb, SUM(b_gidp IS NULL) as b_gidp_incomplete, SUM(b_gidp) AS b_gidp, SUM(b_hbp IS NULL) as b_hbp_incomplete, SUM(b_hbp) AS b_hbp, SUM(b_sh IS NULL) as b_sh_incomplete, SUM(b_sh) AS b_sh, SUM(b_sf IS NULL) as b_sf_incomplete, SUM(b_sf) AS b_sf, SUM(b_ibb IS NULL) as b_ibb_incomplete, SUM(b_ibb) AS b_ibb
FROM sup_team_seasons as st
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE ((team_id=?) OR (team_id=?))
AND type="post"
GROUP BY team_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'ARI',
'PHI'
];
Query Time: 0.01 seconds
Table Build Time: 0.04 seconds
Table Build Time: 0.04 seconds
--------------------------------------
overall_sum_pit
Page Setup Time: 0.00207 seconds
SELECT (SELECT name_abbr FROM sup_team_seasons WHERE team_id=st.team_id AND sup_team_seasons.year_id=MAX(st.year_id) LIMIT 1) as franch_abbr, team_id, MIN(year_id) as year_min, MAX(year_id) as year_max, SUM(wins IS NULL) as wins_incomplete, SUM(wins) AS wins, SUM(losses IS NULL) as losses_incomplete, SUM(losses) AS losses, NULL as games_incomplete, SUM(games) AS games, IF(SUM(p_ip_outs), 27 * SUM(p_er) /SUM(p_ip_outs), IF(SUM(p_er), 1e20, NULL)) as p_earned_run_avg_csk, SUM(p_er IS NULL)+SUM(p_ip_outs IS NULL) as p_earned_run_avg_incomplete, ROUND(IF(SUM(p_ip_outs), 27 * SUM(p_er)/SUM(p_ip_outs), NULL),2) AS p_earned_run_avg, SUM(p_cg IS NULL) as p_cg_incomplete, SUM(p_cg) AS p_cg, SUM(p_sho IS NULL) as p_sho_incomplete, SUM(p_sho) AS p_sho, SUM(p_sv IS NULL) as p_sv_incomplete, SUM(p_sv) AS p_sv, SUM(p_ip_outs) as p_ip_csk, SUM(p_ip_outs IS NULL) as p_ip_incomplete, SUM(p_ip_outs) DIV 3 + 0.1 * MOD(SUM(p_ip_outs),3) AS p_ip, SUM(p_h IS NULL) as p_h_incomplete, SUM(p_h) AS p_h, SUM(p_r IS NULL) as p_r_incomplete, SUM(p_r) AS p_r, SUM(p_er IS NULL) as p_er_incomplete, SUM(p_er) AS p_er, SUM(p_hr IS NULL) as p_hr_incomplete, SUM(p_hr) AS p_hr, SUM(p_bb IS NULL) as p_bb_incomplete, SUM(p_bb) AS p_bb, SUM(p_ibb IS NULL) as p_ibb_incomplete, SUM(p_ibb) AS p_ibb, SUM(p_so IS NULL) as p_so_incomplete, SUM(p_so) AS p_so, SUM(p_hbp IS NULL) as p_hbp_incomplete, SUM(p_hbp) AS p_hbp, SUM(p_bk IS NULL) as p_bk_incomplete, SUM(p_bk) AS p_bk, SUM(p_wp IS NULL) as p_wp_incomplete, SUM(p_wp) AS p_wp, SUM(p_bfp IS NULL) as p_bfp_incomplete, SUM(p_bfp) AS p_bfp, SUM(p_h IS NULL)+SUM(p_hbp IS NULL)+SUM(p_roe IS NULL)+SUM(p_bb IS NULL)+SUM(p_reached_on_strikeout IS NULL) as p_baserunners_incomplete, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_roe,0) + IFNULL(p_reached_on_strikeout,0)) AS p_baserunners, IF(SUM(IFNULL(p_er,0)) = 0, NULL, 100*(SUM(p_er_lg_avg) / SUM(p_er))) as p_earned_run_avg_plus_csk, SUM(p_er_lg_avg IS NULL)+SUM(p_er IS NULL) as p_earned_run_avg_plus_incomplete, ROUND(IF(SUM(IFNULL(p_er,0)) = 0, NULL, 100*(SUM(p_er_lg_avg) / SUM(p_er))),0) AS p_earned_run_avg_plus, IF(SUM(p_ip_outs) = 0, NULL, 3 * SUM(p_h + p_bb) / SUM(p_ip_outs)) as p_whip_csk, SUM(p_bb IS NULL)+SUM(p_h IS NULL)+SUM(p_ip_outs IS NULL) as p_whip_incomplete, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 3 * SUM(p_h + p_bb) / SUM(p_ip_outs)),3) AS p_whip, IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_h) / SUM(p_ip_outs)) as p_hits_per_nine_csk, SUM(p_ip_outs IS NULL)+SUM(p_h IS NULL) as p_hits_per_nine_incomplete, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_h) / SUM(p_ip_outs)),1) AS p_hits_per_nine, IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_hr) / SUM(p_ip_outs)) as p_hr_per_nine_csk, SUM(p_hr IS NULL)+SUM(p_ip_outs IS NULL) as p_hr_per_nine_incomplete, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_hr) / SUM(p_ip_outs)),1) AS p_hr_per_nine, IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_bb) / SUM(p_ip_outs)) as p_bb_per_nine_csk, SUM(p_bb IS NULL)+SUM(p_ip_outs IS NULL) as p_bb_per_nine_incomplete, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_bb) / SUM(p_ip_outs)),1) AS p_bb_per_nine, IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_so) / SUM(p_ip_outs)) as p_so_per_nine_csk, SUM(p_so IS NULL)+SUM(p_ip_outs IS NULL) as p_so_per_nine_incomplete, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_so) / SUM(p_ip_outs)),1) AS p_so_per_nine
FROM sup_team_seasons as st
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE ((team_id=?) OR (team_id=?))
AND type="reg"
GROUP BY team_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'ARI',
'PHI'
];
Query Time: 0.01 seconds
SELECT (SELECT name_abbr FROM sup_team_seasons WHERE team_id=st.team_id AND sup_team_seasons.year_id=MAX(st.year_id) LIMIT 1) as franch_abbr, team_id, MIN(year_id) as year_min, MAX(year_id) as year_max, SUM(wins IS NULL) as wins_incomplete, SUM(wins) AS wins, SUM(losses IS NULL) as losses_incomplete, SUM(losses) AS losses, NULL as games_incomplete, SUM(games) AS games, IF(SUM(p_ip_outs), 27 * SUM(p_er) /SUM(p_ip_outs), IF(SUM(p_er), 1e20, NULL)) as p_earned_run_avg_csk, SUM(p_er IS NULL)+SUM(p_ip_outs IS NULL) as p_earned_run_avg_incomplete, ROUND(IF(SUM(p_ip_outs), 27 * SUM(p_er)/SUM(p_ip_outs), NULL),2) AS p_earned_run_avg, SUM(p_cg IS NULL) as p_cg_incomplete, SUM(p_cg) AS p_cg, SUM(p_sho IS NULL) as p_sho_incomplete, SUM(p_sho) AS p_sho, SUM(p_sv IS NULL) as p_sv_incomplete, SUM(p_sv) AS p_sv, SUM(p_ip_outs) as p_ip_csk, SUM(p_ip_outs IS NULL) as p_ip_incomplete, SUM(p_ip_outs) DIV 3 + 0.1 * MOD(SUM(p_ip_outs),3) AS p_ip, SUM(p_h IS NULL) as p_h_incomplete, SUM(p_h) AS p_h, SUM(p_r IS NULL) as p_r_incomplete, SUM(p_r) AS p_r, SUM(p_er IS NULL) as p_er_incomplete, SUM(p_er) AS p_er, SUM(p_hr IS NULL) as p_hr_incomplete, SUM(p_hr) AS p_hr, SUM(p_bb IS NULL) as p_bb_incomplete, SUM(p_bb) AS p_bb, SUM(p_ibb IS NULL) as p_ibb_incomplete, SUM(p_ibb) AS p_ibb, SUM(p_so IS NULL) as p_so_incomplete, SUM(p_so) AS p_so, SUM(p_hbp IS NULL) as p_hbp_incomplete, SUM(p_hbp) AS p_hbp, SUM(p_bk IS NULL) as p_bk_incomplete, SUM(p_bk) AS p_bk, SUM(p_wp IS NULL) as p_wp_incomplete, SUM(p_wp) AS p_wp, SUM(p_bfp IS NULL) as p_bfp_incomplete, SUM(p_bfp) AS p_bfp, SUM(p_h IS NULL)+SUM(p_hbp IS NULL)+SUM(p_roe IS NULL)+SUM(p_bb IS NULL)+SUM(p_reached_on_strikeout IS NULL) as p_baserunners_incomplete, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_roe,0) + IFNULL(p_reached_on_strikeout,0)) AS p_baserunners, IF(SUM(IFNULL(p_er,0)) = 0, NULL, 100*(SUM(p_er_lg_avg) / SUM(p_er))) as p_earned_run_avg_plus_csk, SUM(p_er_lg_avg IS NULL)+SUM(p_er IS NULL) as p_earned_run_avg_plus_incomplete, ROUND(IF(SUM(IFNULL(p_er,0)) = 0, NULL, 100*(SUM(p_er_lg_avg) / SUM(p_er))),0) AS p_earned_run_avg_plus, IF(SUM(p_ip_outs) = 0, NULL, 3 * SUM(p_h + p_bb) / SUM(p_ip_outs)) as p_whip_csk, SUM(p_bb IS NULL)+SUM(p_h IS NULL)+SUM(p_ip_outs IS NULL) as p_whip_incomplete, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 3 * SUM(p_h + p_bb) / SUM(p_ip_outs)),3) AS p_whip, IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_h) / SUM(p_ip_outs)) as p_hits_per_nine_csk, SUM(p_ip_outs IS NULL)+SUM(p_h IS NULL) as p_hits_per_nine_incomplete, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_h) / SUM(p_ip_outs)),1) AS p_hits_per_nine, IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_hr) / SUM(p_ip_outs)) as p_hr_per_nine_csk, SUM(p_hr IS NULL)+SUM(p_ip_outs IS NULL) as p_hr_per_nine_incomplete, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_hr) / SUM(p_ip_outs)),1) AS p_hr_per_nine, IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_bb) / SUM(p_ip_outs)) as p_bb_per_nine_csk, SUM(p_bb IS NULL)+SUM(p_ip_outs IS NULL) as p_bb_per_nine_incomplete, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_bb) / SUM(p_ip_outs)),1) AS p_bb_per_nine, IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_so) / SUM(p_ip_outs)) as p_so_per_nine_csk, SUM(p_so IS NULL)+SUM(p_ip_outs IS NULL) as p_so_per_nine_incomplete, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_so) / SUM(p_ip_outs)),1) AS p_so_per_nine
FROM sup_team_seasons as st
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE ((team_id=?) OR (team_id=?))
AND type="post"
GROUP BY team_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'ARI',
'PHI'
];
Query Time: 0.01 seconds
Table Build Time: 0.04 seconds
Table Build Time: 0.04 seconds
--------------------------------------
SH->PARAM -- $VAR1 = {
't1yrto' => 2025,
'team_id1' => 'ARI',
'team_id2' => 'PHI',
'match' => 'versus_teamvteam',
't2yrto' => 2025
};
SH->PARAM_NO_DEFAULT -- $VAR1 = {
'match' => 'versus_teamvteam',
'team_id2' => 'PHI',
'team_id1' => 'ARI'
};
Data coverage:
Game data: Game data is only available for the American League, National League, and Federal League. Since 1901 for regular season data, since 1933 for the All-Star Game, and since 1903 for the Postseason.
Season data: Since 1871. Stats relying on play-by-play data are complete back to 1969, nearly complete back to 1950, and mostly complete back to 1912. Postseason data since 1903.
Please see our data coverage page for details.


We're Social...for Statheads
Site Last Updated:
Question, Comment, Feedback, or Correction?
Subscribe to our Free Email Newsletter
Do you have a sports website? Or write about sports? We have tools and resources that can help you use sports data. Find out more.