Max Scherzer vs. José Fernández: Head-to-Head Stats Comparison
--------------------------------------
header_comp
WITH
h2h_record AS (
SELECT p1.person_id as p1_person_id, SUM(p1.win AND p1.type="reg") as p1_rs_wins, SUM(p1.win AND p1.type="post") as p1_po_wins, SUM(p1.loss AND p1.type="reg") as p1_rs_losses, SUM(p1.loss AND p1.type="post") as p1_po_losses, SUM(p1.tie AND p1.type="reg") as p1_rs_ties, SUM(p1.tie AND p1.type="post") as p1_po_ties, p2.person_id as p2_person_id, SUM(p2.win AND p2.type="reg") as p2_rs_wins, SUM(p2.win AND p2.type="post") as p2_po_wins, SUM(p2.loss AND p2.type="reg") as p2_rs_losses, SUM(p2.loss AND p2.type="post") as p2_po_losses, SUM(p2.tie AND p2.type="reg") as p2_rs_ties, SUM(p2.tie AND p2.type="post") as p2_po_ties
FROM (SELECT person_id, win as win, loss as loss, tie as tie, game_id, type, team_id
FROM sup_team_games
JOIN sup_games USING (game_id)
JOIN sup_player_games USING (game_id, team_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE person_id=? ) as p1
JOIN (SELECT person_id, win as win, loss as loss, tie as tie, game_id, type, team_id FROM sup_team_games
JOIN sup_games USING (game_id)
JOIN sup_player_games USING (game_id, team_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE person_id=? ) as p2 ON p1.game_id=p2.game_id AND p1.team_id!=p2.team_id
),
h2h_record_tot AS (
SELECT person_id, rs_wins, rs_losses, rs_ties, po_wins, po_losses, po_ties
FROM (SELECT p1_person_id as person_id, p1_rs_wins as rs_wins, p1_rs_losses as rs_losses, p1_rs_ties as rs_ties, p1_po_wins as po_wins, p1_po_losses as po_losses, p1_po_ties as po_ties
FROM h2h_record
UNION SELECT p2_person_id as person_id, p2_rs_wins as rs_wins, p2_rs_losses as rs_losses, p2_rs_ties as rs_ties, p2_po_wins as po_wins, p2_po_losses as po_losses, p2_po_ties as po_ties
FROM h2h_record) as zzz
WHERE 1
)
SELECT person_id, SUM(IFNULL(p_war,0))+SUM(IFNULL(b_war,0)) as war_csk, ROUND(SUM(IFNULL(p_war,0))+SUM(IFNULL(b_war,0)),1) AS war, IF(default_type="pitch",SUM(p_g),SUM(b_games)) AS games, SUM(p_gs) AS p_gs, SUM(p_ip_outs) as p_ip_csk, SUM(p_ip_outs) DIV 3 + 0.1 * MOD(SUM(p_ip_outs),3) AS p_ip, (SUM(p_w)) / (SUM(p_w) + SUM(p_l)) as p_wlrecord_csk, CONCAT(SUM(p_w), "-", SUM(p_l)) AS p_wlrecord, SUM(p_sv) AS p_sv, 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, ROUND(IF(SUM(p_ip_outs), 27 * SUM(p_er)/SUM(p_ip_outs), NULL),2) AS p_earned_run_avg, IF(SUM(IFNULL(p_er,0)) = 0, NULL, 100*(SUM(p_er_lg_avg) / SUM(p_er))) as p_earned_run_avg_plus_csk, 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, SUM(p_so) AS p_so, IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_so)), NULL, SUM(p_so)/SUM(p_bfp)) as p_strikeout_perc_csk, ROUND(100 * (IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_so)), NULL, SUM(p_so)/SUM(p_bfp))),1) AS p_strikeout_perc, SUM(p_bb) AS p_bb, IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_bb)), NULL, SUM(p_bb)/SUM(p_bfp)) as p_base_on_balls_perc_csk, ROUND(100 * (IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_bb)), NULL, SUM(p_bb)/SUM(p_bfp))),1) AS p_base_on_balls_perc
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
GROUP BY person_id
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos',
'fernan009jos',
'scherz001max'
];
SELECT name_short, name, award_id FROM sup_awards WHERE award_id IN ("allstar","mvp","cyyoung","battitle","eratitle","relief","goldglove","slugger","wsmvp","lcsmvp","tcrown") GROUP BY award_id
SQL PARAMS -- $VAR1 = [];
WITH
champ AS (
SELECT person_id, COUNT(*) as championships
FROM sup_player_team_seasons
LEFT JOIN sup_team_seasons USING (team_id, year_id, comp_id, phase_id)
WHERE person_id=? AND phase_id='reg' AND is_champion_ws=1
),
awards AS (
SELECT person_id,
SUM(award_id="allstar") as `allstar`, SUM(award_id="battitle") as `battitle`, SUM(award_id="cyyoung") as `cyyoung`, SUM(award_id="eratitle") as `eratitle`, SUM(award_id="goldglove") as `goldglove`, SUM(award_id="lcsmvp") as `lcsmvp`, SUM(award_id="mvp") as `mvp`, SUM(award_id="relief") as `relief`, SUM(award_id="slugger") as `slugger`, SUM(award_id="tcrown") as `tcrown`, SUM(award_id="wsmvp") as `wsmvp`
FROM sup_awards_players
WHERE person_id=?
)
SELECT person_id, is_hof, championships, awards.* FROM sup_players
LEFT JOIN awards USING (person_id)
LEFT JOIN champ USING (person_id)
WHERE person_id=?
SQL PARAMS -- $VAR1 = [
'scherz001max',
'scherz001max',
'scherz001max'
];
WITH
champ AS (
SELECT person_id, COUNT(*) as championships
FROM sup_player_team_seasons
LEFT JOIN sup_team_seasons USING (team_id, year_id, comp_id, phase_id)
WHERE person_id=? AND phase_id='reg' AND is_champion_ws=1
),
awards AS (
SELECT person_id,
SUM(award_id="allstar") as `allstar`, SUM(award_id="battitle") as `battitle`, SUM(award_id="cyyoung") as `cyyoung`, SUM(award_id="eratitle") as `eratitle`, SUM(award_id="goldglove") as `goldglove`, SUM(award_id="lcsmvp") as `lcsmvp`, SUM(award_id="mvp") as `mvp`, SUM(award_id="relief") as `relief`, SUM(award_id="slugger") as `slugger`, SUM(award_id="tcrown") as `tcrown`, SUM(award_id="wsmvp") as `wsmvp`
FROM sup_awards_players
WHERE person_id=?
)
SELECT person_id, is_hof, championships, awards.* FROM sup_players
LEFT JOIN awards USING (person_id)
LEFT JOIN champ USING (person_id)
WHERE person_id=?
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'fernan009jos',
'fernan009jos'
];
--------------------------------------
pitch_tot
Page Setup Time: 0.00161 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, SUM(p_w IS NULL) as p_w_incomplete, SUM(p_w) AS p_w, SUM(p_l IS NULL) as p_l_incomplete, SUM(p_l) AS p_l, IF(SUM(p_w + p_l), SUM(p_w) / SUM(p_w + p_l), NULL) as p_win_loss_perc_csk, SUM(p_w IS NULL)+SUM(p_l IS NULL) as p_win_loss_perc_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_w + p_l), SUM(p_w) / SUM(p_w + p_l), NULL),3)) AS p_win_loss_perc, 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_ip_outs IS NULL)+SUM(p_er 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, NULL as p_g_incomplete, SUM(p_g) AS p_g, SUM(p_gs IS NULL) as p_gs_incomplete, SUM(p_gs) AS p_gs, SUM(p_gf IS NULL) as p_gf_incomplete, SUM(p_gf) AS p_gf, 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_reached_on_strikeout IS NULL)+SUM(p_h IS NULL)+SUM(p_roe IS NULL)+SUM(p_hbp IS NULL)+SUM(p_bb 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, SUM(p_ip_outs*((39*p_hr + 9*(p_bb + IFNULL(p_hbp,0)) - 6 * p_so)/p_ip_outs + fip_constant))/SUM(p_ip_outs) as p_fip_csk, SUM(p_hr IS NULL)+SUM(p_hbp IS NULL)+SUM(p_bb IS NULL)+SUM(p_so IS NULL)+SUM(fip_constant IS NULL)+SUM(p_ip_outs IS NULL) as p_fip_incomplete, ROUND(SUM(p_ip_outs*((39*p_hr + 9*(p_bb + IFNULL(p_hbp,0)) - 6 * p_so)/p_ip_outs + fip_constant))/SUM(p_ip_outs),2) AS p_fip, IF(SUM(p_ip_outs) = 0, NULL, 3 * SUM(p_h + p_bb) / SUM(p_ip_outs)) as p_whip_csk, SUM(p_ip_outs IS NULL)+SUM(p_h IS NULL)+SUM(p_bb 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_h IS NULL)+SUM(p_ip_outs 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_ip_outs IS NULL)+SUM(p_hr 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_ip_outs IS NULL)+SUM(p_bb 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_ip_outs IS NULL)+SUM(p_so 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_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
GROUP BY person_id
HAVING p_g>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, SUM(p_w IS NULL) as p_w_incomplete, SUM(p_w) AS p_w, SUM(p_l IS NULL) as p_l_incomplete, SUM(p_l) AS p_l, IF(SUM(p_w + p_l), SUM(p_w) / SUM(p_w + p_l), NULL) as p_win_loss_perc_csk, SUM(p_w IS NULL)+SUM(p_l IS NULL) as p_win_loss_perc_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_w + p_l), SUM(p_w) / SUM(p_w + p_l), NULL),3)) AS p_win_loss_perc, 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_ip_outs IS NULL)+SUM(p_er 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, NULL as p_g_incomplete, SUM(p_g) AS p_g, SUM(p_gs IS NULL) as p_gs_incomplete, SUM(p_gs) AS p_gs, SUM(p_gf IS NULL) as p_gf_incomplete, SUM(p_gf) AS p_gf, 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_reached_on_strikeout IS NULL)+SUM(p_h IS NULL)+SUM(p_roe IS NULL)+SUM(p_hbp IS NULL)+SUM(p_bb 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, SUM(p_ip_outs*((39*p_hr + 9*(p_bb + IFNULL(p_hbp,0)) - 6 * p_so)/p_ip_outs + fip_constant))/SUM(p_ip_outs) as p_fip_csk, SUM(p_hr IS NULL)+SUM(p_hbp IS NULL)+SUM(p_bb IS NULL)+SUM(p_so IS NULL)+SUM(fip_constant IS NULL)+SUM(p_ip_outs IS NULL) as p_fip_incomplete, ROUND(SUM(p_ip_outs*((39*p_hr + 9*(p_bb + IFNULL(p_hbp,0)) - 6 * p_so)/p_ip_outs + fip_constant))/SUM(p_ip_outs),2) AS p_fip, IF(SUM(p_ip_outs) = 0, NULL, 3 * SUM(p_h + p_bb) / SUM(p_ip_outs)) as p_whip_csk, SUM(p_ip_outs IS NULL)+SUM(p_h IS NULL)+SUM(p_bb 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_h IS NULL)+SUM(p_ip_outs 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_ip_outs IS NULL)+SUM(p_hr 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_ip_outs IS NULL)+SUM(p_bb 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_ip_outs IS NULL)+SUM(p_so 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_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="post"
GROUP BY person_id
HAVING p_g>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
Table Build Time: 0.03 seconds
Table Build Time: 0.03 seconds
--------------------------------------
pitch_val
Page Setup Time: 0.00044 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, NULL as p_g_incomplete, SUM(p_g) AS p_g, SUM(p_gs IS NULL) as p_gs_incomplete, SUM(p_gs) AS p_gs, 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_war) as p_war_csk, SUM(p_war IS NULL) as p_war_incomplete, ROUND(SUM(p_war),1) AS p_war, SUM(p_waa) as p_waa_csk, SUM(p_waa IS NULL) as p_waa_incomplete, ROUND(SUM(p_waa),1) AS p_waa
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
GROUP BY person_id
HAVING p_g>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
Table Build Time: 0.02 seconds
--------------------------------------
pitch_tot_ag
Page Setup Time: 0.00208 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, NULL as p_g_incomplete, SUM(p_g) AS p_g, SUM(p_gs IS NULL) as p_gs_incomplete, SUM(p_gs) AS p_gs, 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_reached_on_strikeout IS NULL)+SUM(p_bb IS NULL)+SUM(p_hbp IS NULL)+SUM(p_h IS NULL)+SUM(p_roe 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, SUM(p_ab IS NULL) as p_ab_incomplete, SUM(p_ab) AS p_ab, SUM(p_h IS NULL)+SUM(p_doubles IS NULL)+SUM(p_hr IS NULL)+SUM(p_triples IS NULL) as p_singles_incomplete, SUM(p_h - (p_doubles + p_triples + p_hr)) AS p_singles, SUM(p_doubles IS NULL) as p_doubles_incomplete, SUM(p_doubles) AS p_doubles, SUM(p_triples IS NULL) as p_triples_incomplete, SUM(p_triples) AS p_triples, SUM(p_sb IS NULL) as p_sb_incomplete, SUM(p_sb) AS p_sb, SUM(p_cs IS NULL) as p_cs_incomplete, SUM(p_cs) AS p_cs, IF(SUM(p_sb+p_cs) = 0 OR SUM(p_sb+p_cs) IS NULL,NULL,SUM(p_sb)/SUM(p_sb+p_cs)) as p_stolen_base_perc_csk, SUM(p_cs IS NULL)+SUM(p_sb IS NULL) as p_stolen_base_perc_incomplete, ROUND(100 * (IF(SUM(p_sb+p_cs) = 0 OR SUM(p_sb+p_cs) IS NULL,NULL,SUM(p_sb)/SUM(p_sb+p_cs))),2) AS p_stolen_base_perc, SUM(p_pickoffs IS NULL) as p_pickoffs_incomplete, SUM(p_pickoffs) AS p_pickoffs, SUM(p_gidp IS NULL) as p_gidp_incomplete, SUM(p_gidp) AS p_gidp, SUM(p_sh IS NULL) as p_sh_incomplete, SUM(p_sh) AS p_sh, SUM(p_sf IS NULL) as p_sf_incomplete, SUM(p_sf) AS p_sf, IF(SUM(p_ab) = 0, NULL, SUM(p_h) / SUM(p_ab)) as p_batting_avg_csk, SUM(p_h IS NULL)+SUM(p_ab IS NULL) as p_batting_avg_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab) = 0, NULL, SUM(p_h) / SUM(p_ab)),3)) AS p_batting_avg, IF(SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0)) = 0, NULL, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0)) / SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0))) as p_onbase_perc_csk, SUM(p_h IS NULL)+SUM(p_sf IS NULL)+SUM(p_bb IS NULL)+SUM(p_hbp IS NULL)+SUM(p_ab IS NULL) as p_onbase_perc_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0)) = 0, NULL, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0)) / SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0))),3)) AS p_onbase_perc, IF(SUM(p_ab) = 0, NULL, SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)) as p_slugging_perc_csk, SUM(p_h IS NULL)+SUM(p_triples IS NULL)+SUM(p_doubles IS NULL)+SUM(p_hr IS NULL)+SUM(p_ab IS NULL) as p_slugging_perc_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab) = 0, NULL, SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)),3)) AS p_slugging_perc, IF(SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0)) = 0, NULL, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0)) / SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0))) + IF(SUM(p_ab) = 0, NULL, SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)) as p_onbase_plus_slugging_csk, SUM(p_ab IS NULL)+SUM(p_bb IS NULL)+SUM(p_triples IS NULL)+SUM(p_hbp IS NULL)+SUM(p_hr IS NULL)+SUM(p_doubles IS NULL)+SUM(p_sf IS NULL)+SUM(p_h IS NULL) as p_onbase_plus_slugging_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0)) = 0, NULL, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0)) / SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0))) + IF(SUM(p_ab) = 0, NULL, SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)),3)) AS p_onbase_plus_slugging, IF(sum(p_tob_lg_avg) = 0 || sum(p_tb_lg_avg) = 0, NULL, 100*((SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / sum(p_tb_lg_avg)) + (SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0))/sum(p_tob_lg_avg)) - 1)) as p_onbase_plus_slugging_plus_csk, SUM(p_bb IS NULL)+SUM(p_hr IS NULL)+SUM(p_doubles IS NULL)+SUM(p_hbp IS NULL)+SUM(p_triples IS NULL)+SUM(p_h IS NULL)+SUM(p_tb_lg_avg IS NULL)+SUM(p_tob_lg_avg IS NULL) as p_onbase_plus_slugging_plus_incomplete, ROUND(IF(sum(p_tob_lg_avg) = 0 || sum(p_tb_lg_avg) = 0, NULL, 100*((SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / sum(p_tb_lg_avg)) + (SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0))/sum(p_tob_lg_avg)) - 1)),0) AS p_onbase_plus_slugging_plus, IF(SUM(p_ab) = 0, NULL, SUM(p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)) as p_iso_slugging_csk, SUM(p_doubles IS NULL)+SUM(p_hr IS NULL)+SUM(p_triples IS NULL)+SUM(p_ab IS NULL) as p_iso_slugging_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab) = 0, NULL, SUM(p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)),3)) AS p_iso_slugging, IF(SUM(p_ab-p_hr-IFNULL(p_so,0)+IFNULL(p_sf,0)) = 0, NULL, ROUND(SUM(p_h-p_hr)/SUM(p_ab-p_hr-IFNULL(p_so,0)+IFNULL(p_sf,0)),10)) as p_batting_avg_bip_csk, SUM(p_ab IS NULL)+SUM(p_sf IS NULL)+SUM(p_h IS NULL)+SUM(p_hr IS NULL)+SUM(p_so IS NULL) as p_batting_avg_bip_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab-p_hr-IFNULL(p_so,0)+IFNULL(p_sf,0)) = 0, NULL, ROUND(SUM(p_h-p_hr)/SUM(p_ab-p_hr-IFNULL(p_so,0)+IFNULL(p_sf,0)),10)),3)) AS p_batting_avg_bip, SUM(p_runs_created IS NULL) as p_runs_created_incomplete, SUM(p_runs_created) AS p_runs_created, SUM(p_tb IS NULL) as p_tb_incomplete, SUM(p_tb) AS p_tb, SUM(p_hr IS NULL)+SUM(p_doubles IS NULL)+SUM(p_triples IS NULL) as p_xbh_incomplete, SUM(p_doubles + p_triples + p_hr) AS p_xbh, SUM(p_h IS NULL)+SUM(p_bb IS NULL)+SUM(p_hbp IS NULL) as p_tob_incomplete, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0)) AS p_tob, SUM(p_bb IS NULL)+SUM(p_hbp IS NULL)+SUM(p_roe IS NULL)+SUM(p_h IS NULL)+SUM(p_reached_on_strikeout IS NULL) as p_tob_with_roe_incomplete, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_roe,0) + IFNULL(p_reached_on_strikeout,0)) AS p_tob_with_roe
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
GROUP BY person_id
HAVING p_g>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.01 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, NULL as p_g_incomplete, SUM(p_g) AS p_g, SUM(p_gs IS NULL) as p_gs_incomplete, SUM(p_gs) AS p_gs, 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_reached_on_strikeout IS NULL)+SUM(p_bb IS NULL)+SUM(p_hbp IS NULL)+SUM(p_h IS NULL)+SUM(p_roe 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, SUM(p_ab IS NULL) as p_ab_incomplete, SUM(p_ab) AS p_ab, SUM(p_h IS NULL)+SUM(p_doubles IS NULL)+SUM(p_hr IS NULL)+SUM(p_triples IS NULL) as p_singles_incomplete, SUM(p_h - (p_doubles + p_triples + p_hr)) AS p_singles, SUM(p_doubles IS NULL) as p_doubles_incomplete, SUM(p_doubles) AS p_doubles, SUM(p_triples IS NULL) as p_triples_incomplete, SUM(p_triples) AS p_triples, SUM(p_sb IS NULL) as p_sb_incomplete, SUM(p_sb) AS p_sb, SUM(p_cs IS NULL) as p_cs_incomplete, SUM(p_cs) AS p_cs, IF(SUM(p_sb+p_cs) = 0 OR SUM(p_sb+p_cs) IS NULL,NULL,SUM(p_sb)/SUM(p_sb+p_cs)) as p_stolen_base_perc_csk, SUM(p_cs IS NULL)+SUM(p_sb IS NULL) as p_stolen_base_perc_incomplete, ROUND(100 * (IF(SUM(p_sb+p_cs) = 0 OR SUM(p_sb+p_cs) IS NULL,NULL,SUM(p_sb)/SUM(p_sb+p_cs))),2) AS p_stolen_base_perc, SUM(p_pickoffs IS NULL) as p_pickoffs_incomplete, SUM(p_pickoffs) AS p_pickoffs, SUM(p_gidp IS NULL) as p_gidp_incomplete, SUM(p_gidp) AS p_gidp, SUM(p_sh IS NULL) as p_sh_incomplete, SUM(p_sh) AS p_sh, SUM(p_sf IS NULL) as p_sf_incomplete, SUM(p_sf) AS p_sf, IF(SUM(p_ab) = 0, NULL, SUM(p_h) / SUM(p_ab)) as p_batting_avg_csk, SUM(p_h IS NULL)+SUM(p_ab IS NULL) as p_batting_avg_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab) = 0, NULL, SUM(p_h) / SUM(p_ab)),3)) AS p_batting_avg, IF(SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0)) = 0, NULL, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0)) / SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0))) as p_onbase_perc_csk, SUM(p_h IS NULL)+SUM(p_sf IS NULL)+SUM(p_bb IS NULL)+SUM(p_hbp IS NULL)+SUM(p_ab IS NULL) as p_onbase_perc_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0)) = 0, NULL, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0)) / SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0))),3)) AS p_onbase_perc, IF(SUM(p_ab) = 0, NULL, SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)) as p_slugging_perc_csk, SUM(p_h IS NULL)+SUM(p_triples IS NULL)+SUM(p_doubles IS NULL)+SUM(p_hr IS NULL)+SUM(p_ab IS NULL) as p_slugging_perc_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab) = 0, NULL, SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)),3)) AS p_slugging_perc, IF(SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0)) = 0, NULL, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0)) / SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0))) + IF(SUM(p_ab) = 0, NULL, SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)) as p_onbase_plus_slugging_csk, SUM(p_ab IS NULL)+SUM(p_bb IS NULL)+SUM(p_triples IS NULL)+SUM(p_hbp IS NULL)+SUM(p_hr IS NULL)+SUM(p_doubles IS NULL)+SUM(p_sf IS NULL)+SUM(p_h IS NULL) as p_onbase_plus_slugging_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0)) = 0, NULL, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0)) / SUM(p_ab + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_sf,0))) + IF(SUM(p_ab) = 0, NULL, SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)),3)) AS p_onbase_plus_slugging, IF(sum(p_tob_lg_avg) = 0 || sum(p_tb_lg_avg) = 0, NULL, 100*((SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / sum(p_tb_lg_avg)) + (SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0))/sum(p_tob_lg_avg)) - 1)) as p_onbase_plus_slugging_plus_csk, SUM(p_bb IS NULL)+SUM(p_hr IS NULL)+SUM(p_doubles IS NULL)+SUM(p_hbp IS NULL)+SUM(p_triples IS NULL)+SUM(p_h IS NULL)+SUM(p_tb_lg_avg IS NULL)+SUM(p_tob_lg_avg IS NULL) as p_onbase_plus_slugging_plus_incomplete, ROUND(IF(sum(p_tob_lg_avg) = 0 || sum(p_tb_lg_avg) = 0, NULL, 100*((SUM(p_h + p_doubles + (2 * p_triples) + (3 * p_hr)) / sum(p_tb_lg_avg)) + (SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0))/sum(p_tob_lg_avg)) - 1)),0) AS p_onbase_plus_slugging_plus, IF(SUM(p_ab) = 0, NULL, SUM(p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)) as p_iso_slugging_csk, SUM(p_doubles IS NULL)+SUM(p_hr IS NULL)+SUM(p_triples IS NULL)+SUM(p_ab IS NULL) as p_iso_slugging_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab) = 0, NULL, SUM(p_doubles + (2 * p_triples) + (3 * p_hr)) / SUM(p_ab)),3)) AS p_iso_slugging, IF(SUM(p_ab-p_hr-IFNULL(p_so,0)+IFNULL(p_sf,0)) = 0, NULL, ROUND(SUM(p_h-p_hr)/SUM(p_ab-p_hr-IFNULL(p_so,0)+IFNULL(p_sf,0)),10)) as p_batting_avg_bip_csk, SUM(p_ab IS NULL)+SUM(p_sf IS NULL)+SUM(p_h IS NULL)+SUM(p_hr IS NULL)+SUM(p_so IS NULL) as p_batting_avg_bip_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_ab-p_hr-IFNULL(p_so,0)+IFNULL(p_sf,0)) = 0, NULL, ROUND(SUM(p_h-p_hr)/SUM(p_ab-p_hr-IFNULL(p_so,0)+IFNULL(p_sf,0)),10)),3)) AS p_batting_avg_bip, SUM(p_runs_created IS NULL) as p_runs_created_incomplete, SUM(p_runs_created) AS p_runs_created, SUM(p_tb IS NULL) as p_tb_incomplete, SUM(p_tb) AS p_tb, SUM(p_hr IS NULL)+SUM(p_doubles IS NULL)+SUM(p_triples IS NULL) as p_xbh_incomplete, SUM(p_doubles + p_triples + p_hr) AS p_xbh, SUM(p_h IS NULL)+SUM(p_bb IS NULL)+SUM(p_hbp IS NULL) as p_tob_incomplete, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0)) AS p_tob, SUM(p_bb IS NULL)+SUM(p_hbp IS NULL)+SUM(p_roe IS NULL)+SUM(p_h IS NULL)+SUM(p_reached_on_strikeout IS NULL) as p_tob_with_roe_incomplete, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_roe,0) + IFNULL(p_reached_on_strikeout,0)) AS p_tob_with_roe
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="post"
GROUP BY person_id
HAVING p_g>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.01 seconds
Table Build Time: 0.03 seconds
Table Build Time: 0.03 seconds
--------------------------------------
pitch_tot_sr
Page Setup Time: 0.00082 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, SUM(p_qs IS NULL) as p_qs_incomplete, SUM(p_qs) AS p_qs, IF(SUM(p_gs) = 0, NULL, SUM(p_qs) / SUM(p_gs)) as p_quality_start_perc_csk, SUM(p_qs IS NULL)+SUM(p_gs IS NULL) as p_quality_start_perc_incomplete, ROUND(100 * (IF(SUM(p_gs) = 0, NULL, SUM(p_qs) / SUM(p_gs))),0) AS p_quality_start_perc, IF(SUM(p_gs), SUM(p_game_score_sum) / SUM(p_gs), NULL) as p_game_score_avg_csk, SUM(p_gs IS NULL)+SUM(p_game_score_sum IS NULL) as p_game_score_avg_incomplete, ROUND(IF(SUM(p_gs), SUM(p_game_score_sum) / SUM(p_gs), NULL),1) AS p_game_score_avg, SUM(p_inherited_runners IS NULL) as p_inherited_runners_incomplete, SUM(p_inherited_runners) AS p_inherited_runners, SUM(p_inherited_scored IS NULL) as p_inherited_scored_incomplete, SUM(p_inherited_scored) AS p_inherited_scored, IF(SUM(p_inherited_runners) = 0, NULL, SUM(p_inherited_scored) / SUM(p_inherited_runners)) as p_inherited_scored_perc_csk, SUM(p_inherited_scored IS NULL)+SUM(p_inherited_runners IS NULL) as p_inherited_scored_perc_incomplete, ROUND(100 * (IF(SUM(p_inherited_runners) = 0, NULL, SUM(p_inherited_scored) / SUM(p_inherited_runners))),0) AS p_inherited_scored_perc, SUM(p_blown_saves IS NULL) as p_blown_saves_incomplete, SUM(p_blown_saves) AS p_blown_saves, IF(SUM(IFNULL(p_blown_saves,0) + p_sv) = 0, NULL, SUM(p_sv) / SUM(IFNULL(p_blown_saves,0) + p_sv)) as p_save_perc_csk, SUM(p_sv IS NULL)+SUM(p_blown_saves IS NULL) as p_save_perc_incomplete, ROUND(100 * (IF(SUM(IFNULL(p_blown_saves,0) + p_sv) = 0, NULL, SUM(p_sv) / SUM(IFNULL(p_blown_saves,0) + p_sv))),1) AS p_save_perc, SUM(p_gf IS NULL) as p_gf_incomplete, SUM(p_gf) AS p_gf, SUM(p_g IS NULL)+SUM(p_gs IS NULL) as p_gr_incomplete, SUM(p_g - p_gs) AS p_gr
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
AND p_g>0
GROUP BY person_id
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, SUM(p_qs IS NULL) as p_qs_incomplete, SUM(p_qs) AS p_qs, IF(SUM(p_gs) = 0, NULL, SUM(p_qs) / SUM(p_gs)) as p_quality_start_perc_csk, SUM(p_qs IS NULL)+SUM(p_gs IS NULL) as p_quality_start_perc_incomplete, ROUND(100 * (IF(SUM(p_gs) = 0, NULL, SUM(p_qs) / SUM(p_gs))),0) AS p_quality_start_perc, IF(SUM(p_gs), SUM(p_game_score_sum) / SUM(p_gs), NULL) as p_game_score_avg_csk, SUM(p_gs IS NULL)+SUM(p_game_score_sum IS NULL) as p_game_score_avg_incomplete, ROUND(IF(SUM(p_gs), SUM(p_game_score_sum) / SUM(p_gs), NULL),1) AS p_game_score_avg, SUM(p_inherited_runners IS NULL) as p_inherited_runners_incomplete, SUM(p_inherited_runners) AS p_inherited_runners, SUM(p_inherited_scored IS NULL) as p_inherited_scored_incomplete, SUM(p_inherited_scored) AS p_inherited_scored, IF(SUM(p_inherited_runners) = 0, NULL, SUM(p_inherited_scored) / SUM(p_inherited_runners)) as p_inherited_scored_perc_csk, SUM(p_inherited_scored IS NULL)+SUM(p_inherited_runners IS NULL) as p_inherited_scored_perc_incomplete, ROUND(100 * (IF(SUM(p_inherited_runners) = 0, NULL, SUM(p_inherited_scored) / SUM(p_inherited_runners))),0) AS p_inherited_scored_perc, SUM(p_blown_saves IS NULL) as p_blown_saves_incomplete, SUM(p_blown_saves) AS p_blown_saves, IF(SUM(IFNULL(p_blown_saves,0) + p_sv) = 0, NULL, SUM(p_sv) / SUM(IFNULL(p_blown_saves,0) + p_sv)) as p_save_perc_csk, SUM(p_sv IS NULL)+SUM(p_blown_saves IS NULL) as p_save_perc_incomplete, ROUND(100 * (IF(SUM(IFNULL(p_blown_saves,0) + p_sv) = 0, NULL, SUM(p_sv) / SUM(IFNULL(p_blown_saves,0) + p_sv))),1) AS p_save_perc, SUM(p_gf IS NULL) as p_gf_incomplete, SUM(p_gf) AS p_gf, SUM(p_g IS NULL)+SUM(p_gs IS NULL) as p_gr_incomplete, SUM(p_g - p_gs) AS p_gr
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="post"
AND p_g>0
GROUP BY person_id
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
Table Build Time: 0.03 seconds
Table Build Time: 0.03 seconds
--------------------------------------
pitch_ratio
Page Setup Time: 0.00071 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, NULL as p_g_incomplete, SUM(p_g) AS p_g, SUM(p_gs IS NULL) as p_gs_incomplete, SUM(p_gs) AS p_gs, 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, IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_so)), NULL, SUM(p_so)/SUM(p_bfp)) as p_strikeout_perc_csk, SUM(p_bfp IS NULL)+SUM(p_so IS NULL) as p_strikeout_perc_incomplete, ROUND(100 * (IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_so)), NULL, SUM(p_so)/SUM(p_bfp))),1) AS p_strikeout_perc, IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_bb)), NULL, SUM(p_bb)/SUM(p_bfp)) as p_base_on_balls_perc_csk, SUM(p_bfp IS NULL)+SUM(p_bb IS NULL) as p_base_on_balls_perc_incomplete, ROUND(100 * (IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_bb)), NULL, SUM(p_bb)/SUM(p_bfp))),1) AS p_base_on_balls_perc, IF(SUM(p_bfp)=0,NULL,SUM(p_so-p_bb)/SUM(p_bfp)) as p_strikeout_minus_base_on_balls_perc_csk, SUM(p_so IS NULL)+SUM(p_bb IS NULL)+SUM(p_bfp IS NULL) as p_strikeout_minus_base_on_balls_perc_incomplete, ROUND(100 * (IF(SUM(p_bfp)=0,NULL,SUM(p_so-p_bb)/SUM(p_bfp))),1) AS p_strikeout_minus_base_on_balls_perc
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
GROUP BY person_id
HAVING p_g>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, NULL as p_g_incomplete, SUM(p_g) AS p_g, SUM(p_gs IS NULL) as p_gs_incomplete, SUM(p_gs) AS p_gs, 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, IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_so)), NULL, SUM(p_so)/SUM(p_bfp)) as p_strikeout_perc_csk, SUM(p_bfp IS NULL)+SUM(p_so IS NULL) as p_strikeout_perc_incomplete, ROUND(100 * (IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_so)), NULL, SUM(p_so)/SUM(p_bfp))),1) AS p_strikeout_perc, IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_bb)), NULL, SUM(p_bb)/SUM(p_bfp)) as p_base_on_balls_perc_csk, SUM(p_bfp IS NULL)+SUM(p_bb IS NULL) as p_base_on_balls_perc_incomplete, ROUND(100 * (IF(SUM(p_bfp)=0 OR SUM(ISNULL(p_bfp)) != SUM(ISNULL(p_bb)), NULL, SUM(p_bb)/SUM(p_bfp))),1) AS p_base_on_balls_perc, IF(SUM(p_bfp)=0,NULL,SUM(p_so-p_bb)/SUM(p_bfp)) as p_strikeout_minus_base_on_balls_perc_csk, SUM(p_so IS NULL)+SUM(p_bb IS NULL)+SUM(p_bfp IS NULL) as p_strikeout_minus_base_on_balls_perc_incomplete, ROUND(100 * (IF(SUM(p_bfp)=0,NULL,SUM(p_so-p_bb)/SUM(p_bfp))),1) AS p_strikeout_minus_base_on_balls_perc
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="post"
GROUP BY person_id
HAVING p_g>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
Table Build Time: 0.03 seconds
Table Build Time: 0.03 seconds
--------------------------------------
pitch_pitchsum
Page Setup Time: 0.00061 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, NULL as p_g_incomplete, SUM(p_g) AS p_g, SUM(p_gs IS NULL) as p_gs_incomplete, SUM(p_gs) AS p_gs, 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_pitches IS NULL) as p_pitches_incomplete, SUM(p_pitches) AS p_pitches, IF(SUM(p_gs_with_pitches) = 0, NULL, SUM(p_pitches_in_gs) / SUM(p_gs_with_pitches)) as p_pitches_per_start_csk, SUM(p_pitches_in_gs IS NULL)+SUM(p_gs_with_pitches IS NULL) as p_pitches_per_start_incomplete, ROUND(IF(SUM(p_gs_with_pitches) = 0, NULL, SUM(p_pitches_in_gs) / SUM(p_gs_with_pitches)),0) AS p_pitches_per_start, SUM(p_strikes IS NULL) as p_strikes_incomplete, SUM(p_strikes) AS p_strikes, IF(SUM(p_pitches) = 0, NULL, SUM(p_strikes) / SUM(p_pitches)) as p_strike_perc_csk, SUM(p_strikes IS NULL)+SUM(p_pitches IS NULL) as p_strike_perc_incomplete, ROUND(100 * (IF(SUM(p_pitches) = 0, NULL, SUM(p_strikes) / SUM(p_pitches))),2) AS p_strike_perc
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
GROUP BY person_id
HAVING p_g>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, NULL as p_g_incomplete, SUM(p_g) AS p_g, SUM(p_gs IS NULL) as p_gs_incomplete, SUM(p_gs) AS p_gs, 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_pitches IS NULL) as p_pitches_incomplete, SUM(p_pitches) AS p_pitches, IF(SUM(p_gs_with_pitches) = 0, NULL, SUM(p_pitches_in_gs) / SUM(p_gs_with_pitches)) as p_pitches_per_start_csk, SUM(p_pitches_in_gs IS NULL)+SUM(p_gs_with_pitches IS NULL) as p_pitches_per_start_incomplete, ROUND(IF(SUM(p_gs_with_pitches) = 0, NULL, SUM(p_pitches_in_gs) / SUM(p_gs_with_pitches)),0) AS p_pitches_per_start, SUM(p_strikes IS NULL) as p_strikes_incomplete, SUM(p_strikes) AS p_strikes, IF(SUM(p_pitches) = 0, NULL, SUM(p_strikes) / SUM(p_pitches)) as p_strike_perc_csk, SUM(p_strikes IS NULL)+SUM(p_pitches IS NULL) as p_strike_perc_incomplete, ROUND(100 * (IF(SUM(p_pitches) = 0, NULL, SUM(p_strikes) / SUM(p_pitches))),2) AS p_strike_perc
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="post"
GROUP BY person_id
HAVING p_g>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
Table Build Time: 0.03 seconds
Table Build Time: 0.03 seconds
--------------------------------------
h2h_sum_pitch
Page Setup Time: 0.00125 seconds
WITH
pgames AS (
SELECT person_id, game_id, team_id, year_id, is_pitcher
FROM sup_team_games
JOIN sup_player_games USING (game_id, team_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE 1
),
pgames_list AS (
SELECT p1.game_id
FROM (SELECT game_id, team_id
FROM pgames
WHERE person_id=?
AND is_pitcher=1 ) as p1
JOIN (SELECT game_id, team_id FROM pgames WHERE person_id=?
AND is_pitcher=1 ) as p2 ON p1.game_id=p2.game_id AND p1.team_id!=p2.team_id
)
SELECT person_id, SUM(p_w) AS p_w, SUM(p_l) AS p_l, IF(SUM(p_w + p_l), SUM(p_w) / SUM(p_w + p_l), NULL) as p_win_loss_perc_csk, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_w + p_l), SUM(p_w) / SUM(p_w + p_l), NULL),3)) AS p_win_loss_perc, 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, ROUND(IF(SUM(p_ip_outs), 27 * SUM(p_er)/SUM(p_ip_outs), NULL),2) AS p_earned_run_avg, COUNT(*) AS p_g, SUM(p_games_started) AS p_games_started, SUM(p_gf) AS p_gf, SUM(p_cg) AS p_cg, SUM(p_sho) AS p_sho, SUM(p_s) AS p_s, SUM(p_ip_outs) as p_ip_csk, SUM(p_ip_outs) DIV 3 + 0.1 * MOD(SUM(p_ip_outs),3) AS p_ip, SUM(p_h) AS p_h, SUM(p_r) AS p_r, SUM(p_er) AS p_er, SUM(p_hr) AS p_hr, SUM(p_bb) AS p_bb, SUM(p_ibb) AS p_ibb, SUM(p_so) AS p_so, SUM(p_hbp) AS p_hbp, SUM(p_bk) AS p_bk, SUM(p_wp) AS p_wp, SUM(p_bfp) AS p_bfp, IF(SUM(p_ip_outs) = 0, NULL, 3 * SUM(p_h + p_bb) / SUM(p_ip_outs)) as p_whip_csk, 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, 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, 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, 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, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_so) / SUM(p_ip_outs)),1) AS p_so_per_nine
FROM sup_player_games as st
JOIN (SELECT game_id, year_id, comp_id, phase_id, 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, team_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN (SELECT team_id, year_id, name_abbr, name, link FROM sup_team_seasons GROUP BY team_id, year_id ) as ts USING (team_id, year_id)
JOIN sup_games USING (game_id)
JOIN pgames_list USING (game_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
GROUP BY person_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos',
'fernan009jos',
'scherz001max'
];
Query Time: 0.04 seconds
WITH
pgames AS (
SELECT person_id, game_id, team_id, year_id, is_pitcher
FROM sup_team_games
JOIN sup_player_games USING (game_id, team_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE 1
),
pgames_list AS (
SELECT p1.game_id
FROM (SELECT game_id, team_id
FROM pgames
WHERE person_id=?
AND is_pitcher=1 ) as p1
JOIN (SELECT game_id, team_id FROM pgames WHERE person_id=?
AND is_pitcher=1 ) as p2 ON p1.game_id=p2.game_id AND p1.team_id!=p2.team_id
)
SELECT person_id, SUM(p_w) AS p_w, SUM(p_l) AS p_l, IF(SUM(p_w + p_l), SUM(p_w) / SUM(p_w + p_l), NULL) as p_win_loss_perc_csk, TRIM(LEADING '0' FROM ROUND(IF(SUM(p_w + p_l), SUM(p_w) / SUM(p_w + p_l), NULL),3)) AS p_win_loss_perc, 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, ROUND(IF(SUM(p_ip_outs), 27 * SUM(p_er)/SUM(p_ip_outs), NULL),2) AS p_earned_run_avg, COUNT(*) AS p_g, SUM(p_games_started) AS p_games_started, SUM(p_gf) AS p_gf, SUM(p_cg) AS p_cg, SUM(p_sho) AS p_sho, SUM(p_s) AS p_s, SUM(p_ip_outs) as p_ip_csk, SUM(p_ip_outs) DIV 3 + 0.1 * MOD(SUM(p_ip_outs),3) AS p_ip, SUM(p_h) AS p_h, SUM(p_r) AS p_r, SUM(p_er) AS p_er, SUM(p_hr) AS p_hr, SUM(p_bb) AS p_bb, SUM(p_ibb) AS p_ibb, SUM(p_so) AS p_so, SUM(p_hbp) AS p_hbp, SUM(p_bk) AS p_bk, SUM(p_wp) AS p_wp, SUM(p_bfp) AS p_bfp, IF(SUM(p_ip_outs) = 0, NULL, 3 * SUM(p_h + p_bb) / SUM(p_ip_outs)) as p_whip_csk, 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, 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, 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, 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, ROUND(IF(SUM(p_ip_outs) = 0, NULL, 27 * SUM(p_so) / SUM(p_ip_outs)),1) AS p_so_per_nine
FROM sup_player_games as st
JOIN (SELECT game_id, year_id, comp_id, phase_id, 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, team_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN (SELECT team_id, year_id, name_abbr, name, link FROM sup_team_seasons GROUP BY team_id, year_id ) as ts USING (team_id, year_id)
JOIN sup_games USING (game_id)
JOIN pgames_list USING (game_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="post"
GROUP BY person_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos',
'fernan009jos',
'scherz001max'
];
Query Time: 0.01 seconds
Table Build Time: 0.03 seconds
--------------------------------------
h2h_gamelogs_pitch
Page Setup Time: 0.00200 seconds
WITH
pgames AS (
SELECT person_id, game_id, team_id, year_id, is_pitcher
FROM sup_team_games
JOIN sup_player_games USING (game_id, team_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE 1
),
pgames_list AS (
SELECT p1.game_id
FROM (SELECT game_id, team_id
FROM pgames
WHERE person_id=?
AND is_pitcher=1 ) as p1
JOIN (SELECT game_id, team_id FROM pgames WHERE person_id=?
AND is_pitcher=1 ) as p2 ON p1.game_id=p2.game_id AND p1.team_id!=p2.team_id
)
SELECT person_id, ts.name_abbr as team_name_abbr, ts.link as team_link, game_id, CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, sup_games.link as game_link, IF(p_w=1 AND p_blown_saves=1, 3,
IF(p_l=1 AND p_blown_saves=1, -3,
IF(p_w=1, 5,
IF(p_l=1, -2,
IF(p_s=1, 4,
IF(p_holds=1, 1,
IF(p_blown_saves=1, -1, 0
))))))
)
as p_game_result_csk, CONCAT(
IF(p_sho=1,
CONCAT('SHO',IF(p_inning_first is null OR floor(1 + (p_inning_last - (home_away_neutral='a'))/6)=9,
'',
CONCAT('(',floor(1 + (p_inning_last - (home_away_neutral='a'))/6),')'))),
IF(p_cg=1,
CONCAT('CG',IF(p_inning_first is null OR floor(1 + (p_inning_last - (home_away_neutral='a'))/6)=9,
'',
CONCAT('(',floor(1 + (p_inning_last - (home_away_neutral='a'))/6),')'))),
CONCAT(IF(p_games_started=1,
CONCAT('GS-',IF(p_inning_first is null,' ',floor(1 + (p_inning_last - (home_away_neutral='a'))/6))),
IF(p_inning_first is null,'',
CONCAT(floor(1 + p_inning_first/6),'-',
IF(p_gf=1,CONCAT('GF',
IF(p_inning_first is null OR floor(1 + (p_inning_last - (home_away_neutral='a'))/6)=9,
'',
CONCAT('(',floor(1 + (p_inning_last - (home_away_neutral='a'))/6),')'))),
floor(1 + (p_inning_last - (home_away_neutral='a'))/6)))))))),
IF(p_w=1 AND p_blown_saves=1,', BW',
IF(p_l=1 AND p_blown_saves=1,', BL',
IF(p_w=1 AND p_holds=1,', HW',
IF(p_l=1 AND p_holds=1,', HL',
IF(p_w=1,', W',
IF(p_l=1,', L',
IF(p_s=1,', S',
IF(p_holds=1,', H', IF(p_blown_saves=1,',BS',''))))))))
)
)
AS p_game_result, p_ip_outs as p_ip_csk, p_ip_outs DIV 3 + 0.1 * MOD(p_ip_outs,3) AS p_ip, p_h, p_r, p_er, p_r - p_er AS p_uer, p_hr, p_bb, p_ibb, p_so, p_hbp, p_bk, p_wp, p_bfp, p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_roe,0) + IFNULL(p_reached_on_strikeout,0) AS p_baserunners, p_ab, p_h - (p_doubles + p_triples + p_hr) AS p_singles, p_doubles, p_triples, p_sb, p_cs, p_pickoffs, p_h + p_doubles + 2 * p_triples + 3 * p_hr AS p_tb, p_gidp, p_sh, p_sf, p_doubles + p_triples + p_hr AS p_xbh, IF(p_games_started, p_game_score / p_games_started, p_game_score) as p_game_score_csk, ROUND(IF(p_games_started, p_game_score / p_games_started, p_game_score),0) AS p_game_score, p_pitches, p_strikes, p_wpa_def as p_wpa_def_csk, ROUND(p_wpa_def,1) AS p_wpa_def, p_baseout_runs as p_baseout_runs_csk, ROUND(p_baseout_runs,2) AS p_baseout_runs, p_inherited_runners, p_inherited_scored, p_leverage_index_avg as p_leverage_index_avg_csk, ROUND(p_leverage_index_avg,2) AS p_leverage_index_avg, p_draftkings_points as p_draftkings_points_csk, ROUND(p_draftkings_points,2) AS p_draftkings_points, p_fanduel_points as p_fanduel_points_csk, ROUND(p_fanduel_points,2) AS p_fanduel_points
FROM sup_player_games as st
JOIN (SELECT game_id, year_id, comp_id, phase_id, 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, team_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN (SELECT team_id, year_id, name_abbr, name, link FROM sup_team_seasons GROUP BY team_id, year_id ) as ts USING (team_id, year_id)
JOIN sup_games USING (game_id)
JOIN pgames_list USING (game_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
ORDER BY date DESC, person_id LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos',
'fernan009jos',
'scherz001max'
];
Query Time: 0.03 seconds
WITH
pgames AS (
SELECT person_id, game_id, team_id, year_id, is_pitcher
FROM sup_team_games
JOIN sup_player_games USING (game_id, team_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE 1
),
pgames_list AS (
SELECT p1.game_id
FROM (SELECT game_id, team_id
FROM pgames
WHERE person_id=?
AND is_pitcher=1 ) as p1
JOIN (SELECT game_id, team_id FROM pgames WHERE person_id=?
AND is_pitcher=1 ) as p2 ON p1.game_id=p2.game_id AND p1.team_id!=p2.team_id
)
SELECT person_id, ts.name_abbr as team_name_abbr, ts.link as team_link, game_id, CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, sup_games.link as game_link, IF(p_w=1 AND p_blown_saves=1, 3,
IF(p_l=1 AND p_blown_saves=1, -3,
IF(p_w=1, 5,
IF(p_l=1, -2,
IF(p_s=1, 4,
IF(p_holds=1, 1,
IF(p_blown_saves=1, -1, 0
))))))
)
as p_game_result_csk, CONCAT(
IF(p_sho=1,
CONCAT('SHO',IF(p_inning_first is null OR floor(1 + (p_inning_last - (home_away_neutral='a'))/6)=9,
'',
CONCAT('(',floor(1 + (p_inning_last - (home_away_neutral='a'))/6),')'))),
IF(p_cg=1,
CONCAT('CG',IF(p_inning_first is null OR floor(1 + (p_inning_last - (home_away_neutral='a'))/6)=9,
'',
CONCAT('(',floor(1 + (p_inning_last - (home_away_neutral='a'))/6),')'))),
CONCAT(IF(p_games_started=1,
CONCAT('GS-',IF(p_inning_first is null,' ',floor(1 + (p_inning_last - (home_away_neutral='a'))/6))),
IF(p_inning_first is null,'',
CONCAT(floor(1 + p_inning_first/6),'-',
IF(p_gf=1,CONCAT('GF',
IF(p_inning_first is null OR floor(1 + (p_inning_last - (home_away_neutral='a'))/6)=9,
'',
CONCAT('(',floor(1 + (p_inning_last - (home_away_neutral='a'))/6),')'))),
floor(1 + (p_inning_last - (home_away_neutral='a'))/6)))))))),
IF(p_w=1 AND p_blown_saves=1,', BW',
IF(p_l=1 AND p_blown_saves=1,', BL',
IF(p_w=1 AND p_holds=1,', HW',
IF(p_l=1 AND p_holds=1,', HL',
IF(p_w=1,', W',
IF(p_l=1,', L',
IF(p_s=1,', S',
IF(p_holds=1,', H', IF(p_blown_saves=1,',BS',''))))))))
)
)
AS p_game_result, p_ip_outs as p_ip_csk, p_ip_outs DIV 3 + 0.1 * MOD(p_ip_outs,3) AS p_ip, p_h, p_r, p_er, p_r - p_er AS p_uer, p_hr, p_bb, p_ibb, p_so, p_hbp, p_bk, p_wp, p_bfp, p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_roe,0) + IFNULL(p_reached_on_strikeout,0) AS p_baserunners, p_ab, p_h - (p_doubles + p_triples + p_hr) AS p_singles, p_doubles, p_triples, p_sb, p_cs, p_pickoffs, p_h + p_doubles + 2 * p_triples + 3 * p_hr AS p_tb, p_gidp, p_sh, p_sf, p_doubles + p_triples + p_hr AS p_xbh, IF(p_games_started, p_game_score / p_games_started, p_game_score) as p_game_score_csk, ROUND(IF(p_games_started, p_game_score / p_games_started, p_game_score),0) AS p_game_score, p_pitches, p_strikes, p_wpa_def as p_wpa_def_csk, ROUND(p_wpa_def,1) AS p_wpa_def, p_baseout_runs as p_baseout_runs_csk, ROUND(p_baseout_runs,2) AS p_baseout_runs, p_inherited_runners, p_inherited_scored, p_leverage_index_avg as p_leverage_index_avg_csk, ROUND(p_leverage_index_avg,2) AS p_leverage_index_avg, p_draftkings_points as p_draftkings_points_csk, ROUND(p_draftkings_points,2) AS p_draftkings_points, p_fanduel_points as p_fanduel_points_csk, ROUND(p_fanduel_points,2) AS p_fanduel_points
FROM sup_player_games as st
JOIN (SELECT game_id, year_id, comp_id, phase_id, 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, team_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN (SELECT team_id, year_id, name_abbr, name, link FROM sup_team_seasons GROUP BY team_id, year_id ) as ts USING (team_id, year_id)
JOIN sup_games USING (game_id)
JOIN pgames_list USING (game_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="post"
ORDER BY date DESC, person_id LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos',
'fernan009jos',
'scherz001max'
];
Query Time: 0.01 seconds
Table Build Time: 0.03 seconds
--------------------------------------
bvp_sum_samepos1
Page Setup Time: 0.00151 seconds
SELECT year_game as event_year_id, "reg" as type, PA AS b_pa, AB AS b_ab, H AS b_h, 2B AS b_doubles, 3B AS b_triples, HR AS b_hr, RBI AS b_rbi, BB AS b_bb, SO AS b_so, H/AB as b_batting_avg_csk, TRIM(LEADING '0' FROM ROUND(H/AB,3)) AS b_batting_avg, (H + BB + HBP) / (AB + BB + HBP + SF) as b_onbase_perc_csk, TRIM(LEADING '0' FROM ROUND((H + BB + HBP) / (AB + BB + HBP + SF),3)) AS b_onbase_perc, (H + 2B + (3B*2) + (HR*3)) / AB as b_slugging_perc_csk, TRIM(LEADING '0' FROM ROUND((H + 2B + (3B*2) + (HR*3)) / AB,3)) AS b_slugging_perc, ((H + BB + HBP) / (AB + BB + HBP + SF)) + ((H + 2B + (3B*2) + (HR*3)) / AB) as b_onbase_plus_slugging_csk, TRIM(LEADING '0' FROM ROUND(((H + BB + HBP) / (AB + BB + HBP + SF)) + ((H + 2B + (3B*2) + (HR*3)) / AB),3)) AS b_onbase_plus_slugging, SH AS b_sh, SF AS b_sf, IBB AS b_ibb, HBP AS b_hbp, GIDP AS b_gidp
FROM bvp
JOIN (SELECT key_bbref, key_milb as batter_id FROM reg_xref) as b ON b.key_bbref=result_batter
JOIN (SELECT key_bbref, key_milb as pitcher_id FROM reg_xref) as p ON p.key_bbref=result_pitcher
WHERE ((pitcher_id=?) AND (batter_id=?))
ORDER BY year_game
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos'
];
Query Time: 0.00 seconds
SELECT year_game as event_year_id, "reg" as type, PA AS b_pa, AB AS b_ab, H AS b_h, 2B AS b_doubles, 3B AS b_triples, HR AS b_hr, RBI AS b_rbi, BB AS b_bb, SO AS b_so, H/AB as b_batting_avg_csk, TRIM(LEADING '0' FROM ROUND(H/AB,3)) AS b_batting_avg, (H + BB + HBP) / (AB + BB + HBP + SF) as b_onbase_perc_csk, TRIM(LEADING '0' FROM ROUND((H + BB + HBP) / (AB + BB + HBP + SF),3)) AS b_onbase_perc, (H + 2B + (3B*2) + (HR*3)) / AB as b_slugging_perc_csk, TRIM(LEADING '0' FROM ROUND((H + 2B + (3B*2) + (HR*3)) / AB,3)) AS b_slugging_perc, ((H + BB + HBP) / (AB + BB + HBP + SF)) + ((H + 2B + (3B*2) + (HR*3)) / AB) as b_onbase_plus_slugging_csk, TRIM(LEADING '0' FROM ROUND(((H + BB + HBP) / (AB + BB + HBP + SF)) + ((H + 2B + (3B*2) + (HR*3)) / AB),3)) AS b_onbase_plus_slugging, SH AS b_sh, SF AS b_sf, IBB AS b_ibb, HBP AS b_hbp, GIDP AS b_gidp
FROM bvp_post
JOIN (SELECT key_bbref, key_milb as batter_id FROM reg_xref) as b ON b.key_bbref=result_batter
JOIN (SELECT key_bbref, key_milb as pitcher_id FROM reg_xref) as p ON p.key_bbref=result_pitcher
WHERE ((pitcher_id=?) AND (batter_id=?))
ORDER BY year_game
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos'
];
Query Time: 0.00 seconds
Table Build Time: 0.04 seconds
--------------------------------------
bvp_pa_samepos1
Page Setup Time: 0.00070 seconds
SELECT year_game as event_year_id, CONCAT(date_game,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, (SELECT link FROM sup_games WHERE game_id=date_game_link) as game_link, batter_team_abbr as event_b_team, pitcher_team_abbr as event_p_team, date_game_link as game_id, event_num, team_rel_score, inning, CASE
WHEN runners_on_bases='' THEN '---'
WHEN runners_on_bases='000' THEN '---'
WHEN runners_on_bases='100' THEN '1--'
WHEN runners_on_bases='010' THEN '-2-'
WHEN runners_on_bases='001' THEN '--3'
WHEN runners_on_bases='110' THEN '12-'
WHEN runners_on_bases='011' THEN '-23'
WHEN runners_on_bases='101' THEN '1-3'
WHEN runners_on_bases='111' THEN '123'
ELSE runners_on_bases
END AS runners_on_bases, CONCAT('https://www.baseball-reference.com/tools/def.cgi?html=1&game-event=',date_game_link,'-',event_num) AS runners_on_bases_endpoint, outs, pitches as pitches_pbp_csk, IF(pitches, CONCAT(pitches, " (", ball_strike_count, ")"), "") AS pitches_pbp, CONCAT('https://www.baseball-reference.com/tools/pitch.cgi?html=1&game-event=',date_game_link,'-',event_num) AS pitches_pbp_endpoint, play_desc
FROM event_bat
JOIN (SELECT key_bbref, key_milb as batter_id FROM reg_xref) as b ON b.key_bbref=result_batter
JOIN (SELECT key_bbref, key_milb as pitcher_id FROM reg_xref) as p ON p.key_bbref=result_pitcher
JOIN (SELECT team_id, year_id, name_abbr as batter_team_abbr, link as batter_team_link FROM sup_team_seasons WHERE phase_id="reg" ) as bt ON bt.team_id=team_franch AND bt.year_id=year_game
JOIN (SELECT team_id, year_id, name_abbr as pitcher_team_abbr, link as pitcher_team_link FROM sup_team_seasons WHERE phase_id="reg" ) as pt ON pt.team_id=opp_franch AND pt.year_id=year_game
WHERE ((pitcher_id=?) AND (batter_id=?)) LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos'
];
Query Time: 0.00 seconds
SELECT year_game as event_year_id, CONCAT(date_game,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, (SELECT link FROM sup_games WHERE game_id=date_game_link) as game_link, batter_team_abbr as event_b_team, pitcher_team_abbr as event_p_team, date_game_link as game_id, event_num, team_rel_score, inning, CASE
WHEN runners_on_bases='' THEN '---'
WHEN runners_on_bases='000' THEN '---'
WHEN runners_on_bases='100' THEN '1--'
WHEN runners_on_bases='010' THEN '-2-'
WHEN runners_on_bases='001' THEN '--3'
WHEN runners_on_bases='110' THEN '12-'
WHEN runners_on_bases='011' THEN '-23'
WHEN runners_on_bases='101' THEN '1-3'
WHEN runners_on_bases='111' THEN '123'
ELSE runners_on_bases
END AS runners_on_bases_post, CONCAT('https://www.baseball-reference.com/tools/def.cgi?html=1&game-event=',date_game_link,'-',event_num,'-post') AS runners_on_bases_post_endpoint, outs, pitches as pitches_pbp_post_csk, IF(pitches, CONCAT(pitches, " (", ball_strike_count, ")"), "") AS pitches_pbp_post, CONCAT('https://www.baseball-reference.com/tools/pitch.cgi?html=1&game-event=',date_game_link,'-',event_num,'-post') AS pitches_pbp_post_endpoint, play_desc
FROM event_bat_post
JOIN (SELECT key_bbref, key_milb as batter_id FROM reg_xref) as b ON b.key_bbref=result_batter
JOIN (SELECT key_bbref, key_milb as pitcher_id FROM reg_xref) as p ON p.key_bbref=result_pitcher
JOIN (SELECT team_id, year_id, name_abbr as batter_team_abbr, link as batter_team_link FROM sup_team_seasons WHERE phase_id="reg" ) as bt ON bt.team_id=team_franch AND bt.year_id=year_game
JOIN (SELECT team_id, year_id, name_abbr as pitcher_team_abbr, link as pitcher_team_link FROM sup_team_seasons WHERE phase_id="reg" ) as pt ON pt.team_id=opp_franch AND pt.year_id=year_game
WHERE ((pitcher_id=?) AND (batter_id=?)) LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos'
];
Query Time: 0.00 seconds
Table Build Time: 0.03 seconds
--------------------------------------
bvp_sum_samepos2
Page Setup Time: 0.00097 seconds
SELECT year_game as event_year_id, "reg" as type, PA AS b_pa, AB AS b_ab, H AS b_h, 2B AS b_doubles, 3B AS b_triples, HR AS b_hr, RBI AS b_rbi, BB AS b_bb, SO AS b_so, H/AB as b_batting_avg_csk, TRIM(LEADING '0' FROM ROUND(H/AB,3)) AS b_batting_avg, (H + BB + HBP) / (AB + BB + HBP + SF) as b_onbase_perc_csk, TRIM(LEADING '0' FROM ROUND((H + BB + HBP) / (AB + BB + HBP + SF),3)) AS b_onbase_perc, (H + 2B + (3B*2) + (HR*3)) / AB as b_slugging_perc_csk, TRIM(LEADING '0' FROM ROUND((H + 2B + (3B*2) + (HR*3)) / AB,3)) AS b_slugging_perc, ((H + BB + HBP) / (AB + BB + HBP + SF)) + ((H + 2B + (3B*2) + (HR*3)) / AB) as b_onbase_plus_slugging_csk, TRIM(LEADING '0' FROM ROUND(((H + BB + HBP) / (AB + BB + HBP + SF)) + ((H + 2B + (3B*2) + (HR*3)) / AB),3)) AS b_onbase_plus_slugging, SH AS b_sh, SF AS b_sf, IBB AS b_ibb, HBP AS b_hbp, GIDP AS b_gidp
FROM bvp
JOIN (SELECT key_bbref, key_milb as batter_id FROM reg_xref) as b ON b.key_bbref=result_batter
JOIN (SELECT key_bbref, key_milb as pitcher_id FROM reg_xref) as p ON p.key_bbref=result_pitcher
WHERE ((batter_id=?) AND (pitcher_id=?))
ORDER BY year_game
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos'
];
Query Time: 0.00 seconds
SELECT year_game as event_year_id, "reg" as type, PA AS b_pa, AB AS b_ab, H AS b_h, 2B AS b_doubles, 3B AS b_triples, HR AS b_hr, RBI AS b_rbi, BB AS b_bb, SO AS b_so, H/AB as b_batting_avg_csk, TRIM(LEADING '0' FROM ROUND(H/AB,3)) AS b_batting_avg, (H + BB + HBP) / (AB + BB + HBP + SF) as b_onbase_perc_csk, TRIM(LEADING '0' FROM ROUND((H + BB + HBP) / (AB + BB + HBP + SF),3)) AS b_onbase_perc, (H + 2B + (3B*2) + (HR*3)) / AB as b_slugging_perc_csk, TRIM(LEADING '0' FROM ROUND((H + 2B + (3B*2) + (HR*3)) / AB,3)) AS b_slugging_perc, ((H + BB + HBP) / (AB + BB + HBP + SF)) + ((H + 2B + (3B*2) + (HR*3)) / AB) as b_onbase_plus_slugging_csk, TRIM(LEADING '0' FROM ROUND(((H + BB + HBP) / (AB + BB + HBP + SF)) + ((H + 2B + (3B*2) + (HR*3)) / AB),3)) AS b_onbase_plus_slugging, SH AS b_sh, SF AS b_sf, IBB AS b_ibb, HBP AS b_hbp, GIDP AS b_gidp
FROM bvp_post
JOIN (SELECT key_bbref, key_milb as batter_id FROM reg_xref) as b ON b.key_bbref=result_batter
JOIN (SELECT key_bbref, key_milb as pitcher_id FROM reg_xref) as p ON p.key_bbref=result_pitcher
WHERE ((batter_id=?) AND (pitcher_id=?))
ORDER BY year_game
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos'
];
Query Time: 0.00 seconds
Table Build Time: 0.03 seconds
--------------------------------------
bvp_pa_samepos2
Page Setup Time: 0.00071 seconds
SELECT year_game as event_year_id, CONCAT(date_game,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, (SELECT link FROM sup_games WHERE game_id=date_game_link) as game_link, batter_team_abbr as event_b_team, pitcher_team_abbr as event_p_team, date_game_link as game_id, event_num, team_rel_score, inning, CASE
WHEN runners_on_bases='' THEN '---'
WHEN runners_on_bases='000' THEN '---'
WHEN runners_on_bases='100' THEN '1--'
WHEN runners_on_bases='010' THEN '-2-'
WHEN runners_on_bases='001' THEN '--3'
WHEN runners_on_bases='110' THEN '12-'
WHEN runners_on_bases='011' THEN '-23'
WHEN runners_on_bases='101' THEN '1-3'
WHEN runners_on_bases='111' THEN '123'
ELSE runners_on_bases
END AS runners_on_bases, CONCAT('https://www.baseball-reference.com/tools/def.cgi?html=1&game-event=',date_game_link,'-',event_num) AS runners_on_bases_endpoint, outs, pitches as pitches_pbp_csk, IF(pitches, CONCAT(pitches, " (", ball_strike_count, ")"), "") AS pitches_pbp, CONCAT('https://www.baseball-reference.com/tools/pitch.cgi?html=1&game-event=',date_game_link,'-',event_num) AS pitches_pbp_endpoint, play_desc
FROM event_bat
JOIN (SELECT key_bbref, key_milb as batter_id FROM reg_xref) as b ON b.key_bbref=result_batter
JOIN (SELECT key_bbref, key_milb as pitcher_id FROM reg_xref) as p ON p.key_bbref=result_pitcher
JOIN (SELECT team_id, year_id, name_abbr as batter_team_abbr, link as batter_team_link FROM sup_team_seasons WHERE phase_id="reg" ) as bt ON bt.team_id=team_franch AND bt.year_id=year_game
JOIN (SELECT team_id, year_id, name_abbr as pitcher_team_abbr, link as pitcher_team_link FROM sup_team_seasons WHERE phase_id="reg" ) as pt ON pt.team_id=opp_franch AND pt.year_id=year_game
WHERE ((batter_id=?) AND (pitcher_id=?)) LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos'
];
Query Time: 0.00 seconds
SELECT year_game as event_year_id, CONCAT(date_game,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, (SELECT link FROM sup_games WHERE game_id=date_game_link) as game_link, batter_team_abbr as event_b_team, pitcher_team_abbr as event_p_team, date_game_link as game_id, event_num, team_rel_score, inning, CASE
WHEN runners_on_bases='' THEN '---'
WHEN runners_on_bases='000' THEN '---'
WHEN runners_on_bases='100' THEN '1--'
WHEN runners_on_bases='010' THEN '-2-'
WHEN runners_on_bases='001' THEN '--3'
WHEN runners_on_bases='110' THEN '12-'
WHEN runners_on_bases='011' THEN '-23'
WHEN runners_on_bases='101' THEN '1-3'
WHEN runners_on_bases='111' THEN '123'
ELSE runners_on_bases
END AS runners_on_bases_post, CONCAT('https://www.baseball-reference.com/tools/def.cgi?html=1&game-event=',date_game_link,'-',event_num,'-post') AS runners_on_bases_post_endpoint, outs, pitches as pitches_pbp_post_csk, IF(pitches, CONCAT(pitches, " (", ball_strike_count, ")"), "") AS pitches_pbp_post, CONCAT('https://www.baseball-reference.com/tools/pitch.cgi?html=1&game-event=',date_game_link,'-',event_num,'-post') AS pitches_pbp_post_endpoint, play_desc
FROM event_bat_post
JOIN (SELECT key_bbref, key_milb as batter_id FROM reg_xref) as b ON b.key_bbref=result_batter
JOIN (SELECT key_bbref, key_milb as pitcher_id FROM reg_xref) as p ON p.key_bbref=result_pitcher
JOIN (SELECT team_id, year_id, name_abbr as batter_team_abbr, link as batter_team_link FROM sup_team_seasons WHERE phase_id="reg" ) as bt ON bt.team_id=team_franch AND bt.year_id=year_game
JOIN (SELECT team_id, year_id, name_abbr as pitcher_team_abbr, link as pitcher_team_link FROM sup_team_seasons WHERE phase_id="reg" ) as pt ON pt.team_id=opp_franch AND pt.year_id=year_game
WHERE ((batter_id=?) AND (pitcher_id=?)) LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos'
];
Query Time: 0.00 seconds
Table Build Time: 0.02 seconds
--------------------------------------
bat_total
Page Setup Time: 0.00168 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, 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_ab IS NULL)+SUM(b_triples IS NULL)+SUM(b_doubles IS NULL)+SUM(b_hr IS NULL)+SUM(b_h 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, IF(sum(b_tob_lg_avg) = 0 || sum(b_tb_lg_avg) = 0, NULL, 100*((SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / sum(b_tb_lg_avg)) + (SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0))/sum(b_tob_lg_avg)) - 1)) as b_onbase_plus_slugging_plus_csk, 0 as b_onbase_plus_slugging_plus_incomplete, ROUND(IF(sum(b_tob_lg_avg) = 0 || sum(b_tb_lg_avg) = 0, NULL, 100*((SUM(b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / sum(b_tb_lg_avg)) + (SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0))/sum(b_tob_lg_avg)) - 1)),0) AS b_onbase_plus_slugging_plus, 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_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
AND b_games IS NOT NULL
GROUP BY person_id
HAVING b_pa>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, 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_ab IS NULL)+SUM(b_triples IS NULL)+SUM(b_doubles IS NULL)+SUM(b_hr IS NULL)+SUM(b_h 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_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="post"
AND b_games IS NOT NULL
GROUP BY person_id
HAVING b_pa>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
Table Build Time: 0.03 seconds
Table Build Time: 0.03 seconds
--------------------------------------
bat_value
Page Setup Time: 0.00056 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, 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_war) as b_war_csk, SUM(b_war IS NULL) as b_war_incomplete, ROUND(SUM(b_war),1) AS b_war, SUM(b_waa) as b_waa_csk, SUM(b_waa IS NULL) as b_waa_incomplete, ROUND(SUM(b_waa),1) AS b_waa, SUM(b_war_off) as b_war_off_csk, SUM(b_war_off IS NULL) as b_war_off_incomplete, ROUND(SUM(b_war_off),1) AS b_war_off, SUM(b_war_def) as b_war_def_csk, SUM(b_war_def IS NULL) as b_war_def_incomplete, ROUND(SUM(b_war_def),1) AS b_war_def, SUM(b_runs_batting) as b_runs_batting_csk, SUM(b_runs_batting IS NULL) as b_runs_batting_incomplete, ROUND(SUM(b_runs_batting),0) AS b_runs_batting, SUM(b_runs_double_plays) as b_runs_double_plays_csk, SUM(b_runs_double_plays IS NULL) as b_runs_double_plays_incomplete, ROUND(SUM(b_runs_double_plays),0) AS b_runs_double_plays, SUM(b_runs_baserunning) as b_runs_baserunning_csk, SUM(b_runs_baserunning IS NULL) as b_runs_baserunning_incomplete, ROUND(SUM(b_runs_baserunning),0) AS b_runs_baserunning, SUM(b_runs_fielding) as b_runs_fielding_csk, SUM(b_runs_fielding IS NULL) as b_runs_fielding_incomplete, ROUND(SUM(b_runs_fielding),0) AS b_runs_fielding
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
AND b_games IS NOT NULL
GROUP BY person_id
HAVING b_pa>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
Table Build Time: 0.03 seconds
--------------------------------------
bat_saber
Page Setup Time: 0.00118 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, 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_doubles IS NULL)+SUM(b_hr IS NULL)+SUM(b_triples IS NULL) as b_xbh_incomplete, SUM(b_doubles + b_triples + b_hr) AS b_xbh, SUM(b_hbp IS NULL)+SUM(b_bb IS NULL)+SUM(b_h IS NULL) as b_tob_incomplete, SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) AS b_tob, SUM(b_h IS NULL)+SUM(b_roe IS NULL)+SUM(b_bb IS NULL)+SUM(b_hbp IS NULL) as b_tob_with_roe_incomplete, SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_roe,0)) AS b_tob_with_roe, SUM(b_outs IS NULL) as b_outs_incomplete, SUM(b_outs) AS b_outs, SUM(b_runs_created IS NULL) as b_runs_created_incomplete, SUM(b_runs_created) AS b_runs_created, IF(SUM(b_ab-b_hr-IFNULL(b_so,0)+IFNULL(b_sf,0)) = 0, NULL, SUM(b_h-b_hr)/SUM(b_ab-b_hr-IFNULL(b_so,0)+IFNULL(b_sf,0))) as b_batting_avg_bip_csk, SUM(b_hr IS NULL)+SUM(b_so IS NULL)+SUM(b_sf IS NULL)+SUM(b_h IS NULL)+SUM(b_ab IS NULL) as b_batting_avg_bip_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab-b_hr-IFNULL(b_so,0)+IFNULL(b_sf,0)) = 0, NULL, SUM(b_h-b_hr)/SUM(b_ab-b_hr-IFNULL(b_so,0)+IFNULL(b_sf,0))),3)) AS b_batting_avg_bip, SUM(b_rbi IS NULL)+SUM(b_hr IS NULL)+SUM(b_r IS NULL) as b_runs_produced_incomplete, SUM(b_rbi + b_r - b_hr) AS b_runs_produced, SUM(b_adjusted_batting_runs IS NULL) as b_adjusted_batting_runs_incomplete, SUM(b_adjusted_batting_runs) AS b_adjusted_batting_runs, SUM(b_batting_wins) as b_batting_wins_csk, SUM(b_batting_wins IS NULL) as b_batting_wins_incomplete, ROUND(SUM(b_batting_wins),1) AS b_batting_wins, IF(SUM(b_ab) = 0, NULL, SUM(b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab)) as b_iso_slugging_csk, SUM(b_hr IS NULL)+SUM(b_doubles IS NULL)+SUM(b_triples IS NULL)+SUM(b_ab IS NULL) as b_iso_slugging_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab) = 0, NULL, SUM(b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab)),3)) AS b_iso_slugging, IF(SUM(b_so)=0 OR SUM(b_so) IS NULL, NULL, SUM(b_ab) / SUM(b_so)) as b_at_bats_per_strikeout_csk, SUM(b_ab IS NULL)+SUM(b_so IS NULL) as b_at_bats_per_strikeout_incomplete, ROUND(IF(SUM(b_so)=0 OR SUM(b_so) IS NULL, NULL, SUM(b_ab) / SUM(b_so)),1) AS b_at_bats_per_strikeout, IF( SUM( IF( b_cs IS NOT NULL, b_cs + b_sb, 0 ) ) = 0, NULL, SUM( IF( b_cs IS NOT NULL, b_sb, 0 ) ) / SUM( IF( b_cs IS NOT NULL, b_cs + b_sb, 0 ) ) ) as b_stolen_base_perc_csk, SUM(b_sb IS NULL)+SUM(b_cs IS NULL) as b_stolen_base_perc_incomplete, ROUND(100 * (IF( SUM( IF( b_cs IS NOT NULL, b_cs + b_sb, 0 ) ) = 0, NULL, SUM( IF( b_cs IS NOT NULL, b_sb, 0 ) ) / SUM( IF( b_cs IS NOT NULL, b_cs + b_sb, 0 ) ) )),1) AS b_stolen_base_perc, SUM(b_sb IS NULL)+SUM(b_cs IS NULL) as b_sb_attempts_incomplete, SUM(b_sb + b_cs) AS b_sb_attempts
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
AND b_games IS NOT NULL
GROUP BY person_id
HAVING b_pa>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, 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_doubles IS NULL)+SUM(b_hr IS NULL)+SUM(b_triples IS NULL) as b_xbh_incomplete, SUM(b_doubles + b_triples + b_hr) AS b_xbh, SUM(b_hbp IS NULL)+SUM(b_bb IS NULL)+SUM(b_h IS NULL) as b_tob_incomplete, SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) AS b_tob, SUM(b_h IS NULL)+SUM(b_roe IS NULL)+SUM(b_bb IS NULL)+SUM(b_hbp IS NULL) as b_tob_with_roe_incomplete, SUM(b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_roe,0)) AS b_tob_with_roe, SUM(b_outs IS NULL) as b_outs_incomplete, SUM(b_outs) AS b_outs, SUM(b_runs_created IS NULL) as b_runs_created_incomplete, SUM(b_runs_created) AS b_runs_created, IF(SUM(b_ab-b_hr-IFNULL(b_so,0)+IFNULL(b_sf,0)) = 0, NULL, SUM(b_h-b_hr)/SUM(b_ab-b_hr-IFNULL(b_so,0)+IFNULL(b_sf,0))) as b_batting_avg_bip_csk, SUM(b_hr IS NULL)+SUM(b_so IS NULL)+SUM(b_sf IS NULL)+SUM(b_h IS NULL)+SUM(b_ab IS NULL) as b_batting_avg_bip_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab-b_hr-IFNULL(b_so,0)+IFNULL(b_sf,0)) = 0, NULL, SUM(b_h-b_hr)/SUM(b_ab-b_hr-IFNULL(b_so,0)+IFNULL(b_sf,0))),3)) AS b_batting_avg_bip, SUM(b_rbi IS NULL)+SUM(b_hr IS NULL)+SUM(b_r IS NULL) as b_runs_produced_incomplete, SUM(b_rbi + b_r - b_hr) AS b_runs_produced, SUM(b_adjusted_batting_runs IS NULL) as b_adjusted_batting_runs_incomplete, SUM(b_adjusted_batting_runs) AS b_adjusted_batting_runs, SUM(b_batting_wins) as b_batting_wins_csk, SUM(b_batting_wins IS NULL) as b_batting_wins_incomplete, ROUND(SUM(b_batting_wins),1) AS b_batting_wins, IF(SUM(b_ab) = 0, NULL, SUM(b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab)) as b_iso_slugging_csk, SUM(b_hr IS NULL)+SUM(b_doubles IS NULL)+SUM(b_triples IS NULL)+SUM(b_ab IS NULL) as b_iso_slugging_incomplete, TRIM(LEADING '0' FROM ROUND(IF(SUM(b_ab) = 0, NULL, SUM(b_doubles + (2 * b_triples) + (3 * b_hr)) / SUM(b_ab)),3)) AS b_iso_slugging, IF(SUM(b_so)=0 OR SUM(b_so) IS NULL, NULL, SUM(b_ab) / SUM(b_so)) as b_at_bats_per_strikeout_csk, SUM(b_ab IS NULL)+SUM(b_so IS NULL) as b_at_bats_per_strikeout_incomplete, ROUND(IF(SUM(b_so)=0 OR SUM(b_so) IS NULL, NULL, SUM(b_ab) / SUM(b_so)),1) AS b_at_bats_per_strikeout, IF( SUM( IF( b_cs IS NOT NULL, b_cs + b_sb, 0 ) ) = 0, NULL, SUM( IF( b_cs IS NOT NULL, b_sb, 0 ) ) / SUM( IF( b_cs IS NOT NULL, b_cs + b_sb, 0 ) ) ) as b_stolen_base_perc_csk, SUM(b_sb IS NULL)+SUM(b_cs IS NULL) as b_stolen_base_perc_incomplete, ROUND(100 * (IF( SUM( IF( b_cs IS NOT NULL, b_cs + b_sb, 0 ) ) = 0, NULL, SUM( IF( b_cs IS NOT NULL, b_sb, 0 ) ) / SUM( IF( b_cs IS NOT NULL, b_cs + b_sb, 0 ) ) )),1) AS b_stolen_base_perc, SUM(b_sb IS NULL)+SUM(b_cs IS NULL) as b_sb_attempts_incomplete, SUM(b_sb + b_cs) AS b_sb_attempts
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="post"
AND b_games IS NOT NULL
GROUP BY person_id
HAVING b_pa>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
Table Build Time: 0.03 seconds
Table Build Time: 0.03 seconds
--------------------------------------
bat_win_prob
Page Setup Time: 0.00067 seconds
SELECT person_id, IF(MIN(age)=MAX(age), MIN(age), CONCAT(MIN(age), '-', MAX(age))) as age_range, MIN(year_id) as year_min, MAX(year_id) as year_max, 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_wpa_bat) as b_wpa_bat_csk, SUM(b_wpa_bat IS NULL) as b_wpa_bat_incomplete, ROUND(SUM(b_wpa_bat),1) AS b_wpa_bat, SUM(b_wpa_li_adjusted) as b_wpa_li_adjusted_csk, SUM(b_wpa_li_adjusted IS NULL) as b_wpa_li_adjusted_incomplete, ROUND(SUM(b_wpa_li_adjusted),1) AS b_wpa_li_adjusted, SUM(b_wpa_bat)/(SUM(b_wpa_plays*b_leverage_index_avg)/SUM(b_wpa_plays)) - SUM(b_wpa_li_adjusted) as b_wpa_clutch_csk, SUM(b_wpa_plays IS NULL)+SUM(b_leverage_index_avg IS NULL)+SUM(b_wpa_li_adjusted IS NULL)+SUM(b_wpa_bat IS NULL) as b_wpa_clutch_incomplete, ROUND(SUM(b_wpa_bat)/(SUM(b_wpa_plays*b_leverage_index_avg)/SUM(b_wpa_plays)) - SUM(b_wpa_li_adjusted),1) AS b_wpa_clutch, SUM(b_baseout_runs) as b_baseout_runs_csk, SUM(b_baseout_runs IS NULL) as b_baseout_runs_incomplete, ROUND(SUM(b_baseout_runs),2) AS b_baseout_runs, SUM(b_baseout_wins) as b_baseout_wins_csk, SUM(b_baseout_wins IS NULL) as b_baseout_wins_incomplete, ROUND(SUM(b_baseout_wins),1) AS b_baseout_wins, SUM(b_re24_baseout_li) as b_re24_baseout_li_csk, SUM(b_re24_baseout_li IS NULL) as b_re24_baseout_li_incomplete, ROUND(SUM(b_re24_baseout_li),2) AS b_re24_baseout_li, SUM(b_wpa_plays*b_leverage_index_avg)/SUM(b_wpa_plays) as b_leverage_index_avg_csk, SUM(b_wpa_plays IS NULL)+SUM(b_leverage_index_avg IS NULL) as b_leverage_index_avg_incomplete, ROUND(SUM(b_wpa_plays*b_leverage_index_avg)/SUM(b_wpa_plays),2) AS b_leverage_index_avg
FROM sup_player_team_seasons as st
JOIN sup_people USING (person_id)
JOIN sup_players USING (person_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN sup_comp_seasons USING (comp_id, year_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
AND b_games IS NOT NULL
GROUP BY person_id
HAVING b_pa>0
ORDER BY person_id
SQL PARAMS -- $VAR1 = [
'fernan009jos',
'scherz001max'
];
Query Time: 0.00 seconds
Table Build Time: 0.03 seconds
--------------------------------------
h2h_sum_bat
Page Setup Time: 0.00123 seconds
WITH
pgames AS (
SELECT person_id, game_id, team_id, year_id
FROM sup_team_games
JOIN sup_player_games USING (game_id, team_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE 1
),
pgames_list AS (
SELECT p1.game_id
FROM (SELECT game_id, team_id
FROM pgames
WHERE person_id=? ) as p1
JOIN (SELECT game_id, team_id FROM pgames WHERE person_id=? ) as p2 ON p1.game_id=p2.game_id AND p1.team_id!=p2.team_id
)
SELECT person_id, COUNT(*) AS b_games, SUM(b_pa) AS b_pa, SUM(b_ab) AS b_ab, 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_rbi) AS b_rbi, SUM(b_sb) AS b_sb, SUM(b_cs) AS b_cs, SUM(b_bb) AS b_bb, SUM(b_so) AS b_so, 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, SUM(b_h + b_doubles + 2 * b_triples + 3 * b_hr) AS b_tb, SUM(b_gidp) AS b_gidp, SUM(b_hbp) AS b_hbp, SUM(b_sh) AS b_sh, SUM(b_sf) AS b_sf, SUM(b_ibb) AS b_ibb
FROM sup_player_games as st
JOIN (SELECT game_id, year_id, comp_id, phase_id, 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, team_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN (SELECT team_id, year_id, name_abbr, name, link FROM sup_team_seasons GROUP BY team_id, year_id ) as ts USING (team_id, year_id)
JOIN sup_games USING (game_id)
JOIN pgames_list USING (game_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
GROUP BY person_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos',
'fernan009jos',
'scherz001max'
];
Query Time: 0.03 seconds
WITH
pgames AS (
SELECT person_id, game_id, team_id, year_id
FROM sup_team_games
JOIN sup_player_games USING (game_id, team_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE 1
),
pgames_list AS (
SELECT p1.game_id
FROM (SELECT game_id, team_id
FROM pgames
WHERE person_id=? ) as p1
JOIN (SELECT game_id, team_id FROM pgames WHERE person_id=? ) as p2 ON p1.game_id=p2.game_id AND p1.team_id!=p2.team_id
)
SELECT person_id, COUNT(*) AS b_games, SUM(b_pa) AS b_pa, SUM(b_ab) AS b_ab, 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_rbi) AS b_rbi, SUM(b_sb) AS b_sb, SUM(b_cs) AS b_cs, SUM(b_bb) AS b_bb, SUM(b_so) AS b_so, 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, SUM(b_h + b_doubles + 2 * b_triples + 3 * b_hr) AS b_tb, SUM(b_gidp) AS b_gidp, SUM(b_hbp) AS b_hbp, SUM(b_sh) AS b_sh, SUM(b_sf) AS b_sf, SUM(b_ibb) AS b_ibb
FROM sup_player_games as st
JOIN (SELECT game_id, year_id, comp_id, phase_id, 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, team_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN (SELECT team_id, year_id, name_abbr, name, link FROM sup_team_seasons GROUP BY team_id, year_id ) as ts USING (team_id, year_id)
JOIN sup_games USING (game_id)
JOIN pgames_list USING (game_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="post"
GROUP BY person_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos',
'fernan009jos',
'scherz001max'
];
Query Time: 0.01 seconds
Table Build Time: 0.03 seconds
--------------------------------------
h2h_gamelogs_bat
Page Setup Time: 0.00176 seconds
WITH
pgames AS (
SELECT person_id, game_id, team_id, year_id
FROM sup_team_games
JOIN sup_player_games USING (game_id, team_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE 1
),
pgames_list AS (
SELECT p1.game_id
FROM (SELECT game_id, team_id
FROM pgames
WHERE person_id=? ) as p1
JOIN (SELECT game_id, team_id FROM pgames WHERE person_id=? ) as p2 ON p1.game_id=p2.game_id AND p1.team_id!=p2.team_id
)
SELECT person_id, ts.name_abbr as team_name_abbr, ts.link as team_link, game_id, CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, sup_games.link as game_link, IF(b_games_started,"*","") AS b_games_started, (b_inning_last - b_inning_first) + 1 AS b_innings_played, b_lineup_position, b_pa, b_ab, b_r, b_h, b_doubles, b_triples, b_hr, b_rbi, b_sb, b_cs, b_bb, b_so, IF(b_ab, b_h / b_ab, NULL) as b_batting_avg_csk, TRIM(LEADING '0' FROM ROUND(IF(b_ab, b_h / b_ab, NULL),3)) AS b_batting_avg, IF((b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), (b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / (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((b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), (b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / (b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL),3)) AS b_onbase_perc, IF(b_ab, (b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / b_ab, NULL) as b_slugging_perc_csk, TRIM(LEADING '0' FROM ROUND(IF(b_ab, (b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / b_ab, NULL),3)) AS b_slugging_perc, IF((b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), (b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / (b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(b_ab, (b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / b_ab, NULL) as b_onbase_plus_slugging_csk, TRIM(LEADING '0' FROM ROUND(IF((b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), (b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / (b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(b_ab, (b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / b_ab, NULL),3)) AS b_onbase_plus_slugging, b_h + b_doubles + 2 * b_triples + 3 * b_hr AS b_tb, b_gidp, b_hbp, b_sh, b_sf, b_ibb, b_leverage_index_avg as b_leverage_index_avg_csk, ROUND(b_leverage_index_avg,2) AS b_leverage_index_avg, b_wpa as b_wpa_csk, ROUND(b_wpa,3) AS b_wpa, b_cli_avg as b_cli_avg_csk, ROUND(b_cli_avg,2) AS b_cli_avg, b_cwpa * 100 as b_cwpa_csk, ROUND(b_cwpa * 100,2) AS b_cwpa, b_baseout_runs as b_baseout_runs_csk, ROUND(b_baseout_runs,2) AS b_baseout_runs, b_draftkings_points as b_draftkings_points_csk, ROUND(b_draftkings_points,2) AS b_draftkings_points, b_fanduel_points as b_fanduel_points_csk, ROUND(b_fanduel_points,2) AS b_fanduel_points, SUBSTRING(CONCAT(
IF(is_pinch_hitter, ' PH',''),
IF(is_pinch_runner, ' PR',''),
IF(is_shortstop, ' SS',''),
IF(is_catcher, ' C', ''),
IF(is_second_base, ' 2B',''),
IF(is_center_field, ' CF',''),
IF(is_third_base, ' 3B',''),
IF(is_right_field, ' RF',''),
IF(is_left_field, ' LF',''),
IF(is_first_base, ' 1B',''),
IF(is_pitcher, ' P', ''),
IF(is_designated_hitter, ' DH','')
),1)
AS pos_game
FROM sup_player_games as st
JOIN (SELECT game_id, year_id, comp_id, phase_id, 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, team_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN (SELECT team_id, year_id, name_abbr, name, link FROM sup_team_seasons GROUP BY team_id, year_id ) as ts USING (team_id, year_id)
JOIN sup_games USING (game_id)
JOIN pgames_list USING (game_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="reg"
ORDER BY date DESC, person_id LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos',
'fernan009jos',
'scherz001max'
];
Query Time: 0.03 seconds
WITH
pgames AS (
SELECT person_id, game_id, team_id, year_id
FROM sup_team_games
JOIN sup_player_games USING (game_id, team_id)
JOIN sup_phase_seasons USING (year_id, comp_id, phase_id)
WHERE 1
),
pgames_list AS (
SELECT p1.game_id
FROM (SELECT game_id, team_id
FROM pgames
WHERE person_id=? ) as p1
JOIN (SELECT game_id, team_id FROM pgames WHERE person_id=? ) as p2 ON p1.game_id=p2.game_id AND p1.team_id!=p2.team_id
)
SELECT person_id, ts.name_abbr as team_name_abbr, ts.link as team_link, game_id, CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, sup_games.link as game_link, IF(b_games_started,"*","") AS b_games_started, (b_inning_last - b_inning_first) + 1 AS b_innings_played, b_lineup_position, b_pa, b_ab, b_r, b_h, b_doubles, b_triples, b_hr, b_rbi, b_sb, b_cs, b_bb, b_so, IF(b_ab, b_h / b_ab, NULL) as b_batting_avg_csk, TRIM(LEADING '0' FROM ROUND(IF(b_ab, b_h / b_ab, NULL),3)) AS b_batting_avg, IF((b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), (b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / (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((b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), (b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / (b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL),3)) AS b_onbase_perc, IF(b_ab, (b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / b_ab, NULL) as b_slugging_perc_csk, TRIM(LEADING '0' FROM ROUND(IF(b_ab, (b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / b_ab, NULL),3)) AS b_slugging_perc, IF((b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), (b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / (b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(b_ab, (b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / b_ab, NULL) as b_onbase_plus_slugging_csk, TRIM(LEADING '0' FROM ROUND(IF((b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), (b_h + IFNULL(b_bb,0) + IFNULL(b_hbp,0)) / (b_ab + IFNULL(b_bb,0) + IFNULL(b_hbp,0) + IFNULL(b_sf,0)), NULL) + IF(b_ab, (b_h + b_doubles + (2 * b_triples) + (3 * b_hr)) / b_ab, NULL),3)) AS b_onbase_plus_slugging, b_h + b_doubles + 2 * b_triples + 3 * b_hr AS b_tb, b_gidp, b_hbp, b_sh, b_sf, b_ibb, b_leverage_index_avg as b_leverage_index_avg_csk, ROUND(b_leverage_index_avg,2) AS b_leverage_index_avg, b_wpa as b_wpa_csk, ROUND(b_wpa,3) AS b_wpa, b_cli_avg as b_cli_avg_csk, ROUND(b_cli_avg,2) AS b_cli_avg, b_cwpa * 100 as b_cwpa_csk, ROUND(b_cwpa * 100,2) AS b_cwpa, b_baseout_runs as b_baseout_runs_csk, ROUND(b_baseout_runs,2) AS b_baseout_runs, b_draftkings_points as b_draftkings_points_csk, ROUND(b_draftkings_points,2) AS b_draftkings_points, b_fanduel_points as b_fanduel_points_csk, ROUND(b_fanduel_points,2) AS b_fanduel_points, SUBSTRING(CONCAT(
IF(is_pinch_hitter, ' PH',''),
IF(is_pinch_runner, ' PR',''),
IF(is_shortstop, ' SS',''),
IF(is_catcher, ' C', ''),
IF(is_second_base, ' 2B',''),
IF(is_center_field, ' CF',''),
IF(is_third_base, ' 3B',''),
IF(is_right_field, ' RF',''),
IF(is_left_field, ' LF',''),
IF(is_first_base, ' 1B',''),
IF(is_pitcher, ' P', ''),
IF(is_designated_hitter, ' DH','')
),1)
AS pos_game
FROM sup_player_games as st
JOIN (SELECT game_id, year_id, comp_id, phase_id, 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, team_id)
JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
JOIN (SELECT team_id, year_id, name_abbr, name, link FROM sup_team_seasons GROUP BY team_id, year_id ) as ts USING (team_id, year_id)
JOIN sup_games USING (game_id)
JOIN pgames_list USING (game_id)
WHERE ((person_id=?) OR (person_id=?))
AND type="post"
ORDER BY date DESC, person_id LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'scherz001max',
'fernan009jos',
'fernan009jos',
'scherz001max'
];
Query Time: 0.01 seconds
Table Build Time: 0.03 seconds
--------------------------------------
SH->PARAM -- $VAR1 = {
't2yrto' => 2025,
'match' => 'versus_playervplayer',
'player_id2' => 'fernan009jos',
'player_id1' => 'scherz001max',
't1yrto' => 2025
};
SH->PARAM_NO_DEFAULT -- $VAR1 = {
'player_id2' => 'fernan009jos',
'player_id1' => 'scherz001max'
};
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.