Shohei Ohtani vs. Boston Red Sox

Compare players and teams or see head to head results between teams, players, player vs. team, or batter vs. pitcher. • Tutorial VideoSample SearchesData Coverage
THIS QUESTION WAS ANSWERED USING
Stathead Baseball Logo POWERED BY Baseball Reference Logo
Your All Access Pass to the Baseball Database Go beyond the basics. Become a Stathead
Start Your FREE Trial
Display Query »
--------------------------------------

header_pvt_summary

WITH
  rspvt AS (
SELECT person_id, COUNT(*) as games, SUM(win=1) as wins, SUM(loss=1) as losses, SUM(tie=1) as ties, 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_s) AS p_s, 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, SUM(p_so) AS p_so, SUM(p_bb) AS p_bb
FROM sup_player_games as st
  JOIN (SELECT win, loss, tie, game_id, year_id, comp_id, phase_id, team_id, opp_team_id FROM sup_team_games) as tg USING (game_id, team_id)
  JOIN sup_games USING (game_id)
  JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
WHERE ((person_id=?))
  AND opp_team_id=?
  AND type="reg"  
  ),
  popvt AS (
SELECT person_id, COUNT(*) as games, SUM(win=1) as wins, SUM(loss=1) as losses, 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_s) AS p_s, 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, SUM(p_so) AS p_so, SUM(p_bb) AS p_bb
FROM sup_player_games as st
  JOIN (SELECT win, loss, tie, game_id, year_id, comp_id, phase_id, team_id, opp_team_id FROM sup_team_games) as tg USING (game_id, team_id)
  JOIN sup_games USING (game_id)
  JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
WHERE ((person_id=?))
  AND opp_team_id=?
  AND type="post"  
  )
SELECT rspvt.person_id, rspvt.games as rspvt_games, rspvt.wins as rspvt_wins, rspvt.losses as rspvt_losses, rspvt.ties as rspvt_ties, popvt.games as popvt_games, popvt.wins as popvt_wins, popvt.losses as popvt_losses, rspvt.p_ip AS rspvt_p_ip, popvt.p_ip AS popvt_p_ip, rspvt.p_wlrecord AS rspvt_p_wlrecord, popvt.p_wlrecord AS popvt_p_wlrecord, rspvt.p_s AS rspvt_p_s, popvt.p_s AS popvt_p_s, rspvt.p_earned_run_avg AS rspvt_p_earned_run_avg, popvt.p_earned_run_avg AS popvt_p_earned_run_avg, rspvt.p_so AS rspvt_p_so, popvt.p_so AS popvt_p_so, rspvt.p_bb AS rspvt_p_bb, popvt.p_bb AS popvt_p_bb
FROM rspvt
  JOIN popvt
WHERE 1  LIMIT 0, 200

SQL PARAMS -- $VAR1 = [
          'otani-000sho',
          'BOS',
          'otani-000sho',
          'BOS'
        ];

--------------------------------------

bvp_sum_b

Page Setup Time: 0.00136 seconds

SELECT year_game as event_year_id, name_display, name_display_csk, CONCAT("/baseball/versus-finder.cgi?request=1&player_id1=",batter_id,"&player_id2=",pitcher_id,"") as name_display_link, 1 as name_display_link_no_full, "reg" as type, current_team, UPPER(SUBSTRING(bats,1,1)) AS bats, SUM(PA) AS b_pa, SUM(AB) AS b_ab, SUM(H) AS b_h, SUM(2B) AS b_doubles, SUM(3B) AS b_triples, SUM(HR) AS b_hr, SUM(RBI) AS b_rbi, SUM(BB) AS b_bb, SUM(SO) AS b_so, SUM(H)/SUM(AB) as b_batting_avg_csk, TRIM(LEADING '0' FROM ROUND(SUM(H)/SUM(AB),3)) AS b_batting_avg, (SUM(H) + SUM(BB) + SUM(HBP)) / (SUM(AB) + SUM(BB) + SUM(HBP) + SUM(SF)) as b_onbase_perc_csk, TRIM(LEADING '0' FROM ROUND((SUM(H) + SUM(BB) + SUM(HBP)) / (SUM(AB) + SUM(BB) + SUM(HBP) + SUM(SF)),3)) AS b_onbase_perc, (SUM(H) + SUM(2B) + (SUM(3B)*2) + (SUM(HR)*3)) / SUM(AB) as b_slugging_perc_csk, TRIM(LEADING '0' FROM ROUND((SUM(H) + SUM(2B) + (SUM(3B)*2) + (SUM(HR)*3)) / SUM(AB),3)) AS b_slugging_perc, ((SUM(H) + SUM(BB) + SUM(HBP)) / (SUM(AB) + SUM(BB) + SUM(HBP) + SUM(SF))) + ((SUM(H) + SUM(2B) + (SUM(3B)*2) + (SUM(HR)*3)) / SUM(AB)) as b_onbase_plus_slugging_csk, TRIM(LEADING '0' FROM ROUND(((SUM(H) + SUM(BB) + SUM(HBP)) / (SUM(AB) + SUM(BB) + SUM(HBP) + SUM(SF))) + ((SUM(H) + SUM(2B) + (SUM(3B)*2) + (SUM(HR)*3)) / SUM(AB)),3)) AS b_onbase_plus_slugging, SUM(SH) AS b_sh, SUM(SF) AS b_sf, SUM(IBB) AS b_ibb, SUM(HBP) AS b_hbp, SUM(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
  LEFT JOIN (SELECT franch_ID as current_team, player_ID FROM __mlbam_rosters WHERE is_roster_mlb="Y"
  AND status_code="A"
  AND level_id="mlb"  ) as rost ON player_ID=result_batter
  JOIN sup_players ON batter_id=person_id
  JOIN sup_people USING (person_id)
  JOIN (SELECT is_active, person_id FROM sup_players) as pmeta ON pitcher_id=pmeta.person_id
WHERE pmeta.is_active=1
  AND ((pitcher_id=?)) 
GROUP BY batter_id
HAVING current_team=?
ORDER BY b_pa DESC 

SQL PARAMS -- $VAR1 = [
          'otani-000sho',
          'BOS'
        ];

Query Time: 0.02 seconds
Table Build Time: 0.03 seconds


--------------------------------------

pvt_totals

Page Setup Time: 0.00251 seconds

SELECT year_id as year_id_csk, year_id as year_id, GROUP_CONCAT(DISTINCT CONCAT('<a href="', 'DOMAIN', ts.link, '" target="_blank">', ts.name_abbr, '</a>')) as teams_played_for, 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(IF(p_er IS NULL, 0, p_r - p_er)) AS p_uer, 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, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_roe,0) + IFNULL(p_reached_on_strikeout,0)) AS p_baserunners
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, phase_id FROM sup_team_seasons) as ts USING (team_id, year_id, phase_id)
WHERE ((person_id=?))
  AND opp_team_id=?
  AND type="reg" 
GROUP BY year_id
ORDER BY year_id LIMIT 0, 200

SQL PARAMS -- $VAR1 = [
          'otani-000sho',
          'BOS'
        ];

Query Time: 0.02 seconds
SELECT year_id as year_id_csk, year_id as year_id, GROUP_CONCAT(DISTINCT CONCAT('<a href="', 'DOMAIN', ts.link, '" target="_blank">', ts.name_abbr, '</a>')) as teams_played_for, 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(IF(p_er IS NULL, 0, p_r - p_er)) AS p_uer, 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, SUM(p_h + IFNULL(p_bb,0) + IFNULL(p_hbp,0) + IFNULL(p_roe,0) + IFNULL(p_reached_on_strikeout,0)) AS p_baserunners
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, phase_id FROM sup_team_seasons) as ts USING (team_id, year_id, phase_id)
WHERE ((person_id=?))
  AND opp_team_id=?
  AND type="post" 
GROUP BY year_id
ORDER BY year_id LIMIT 0, 200

SQL PARAMS -- $VAR1 = [
          'otani-000sho',
          'BOS'
        ];

Query Time: 0.01 seconds
Table Build Time: 0.04 seconds


--------------------------------------

pvt_gamelogs

Page Setup Time: 0.00262 seconds

SELECT age_on_day, ts.name_abbr as team_name_abbr, ts.link as team_link, opp_team_link, CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, game_id, sup_games.link as game_link, year_id as year_id_csk, year_id as year_id, IF(home_away_neutral = 'a','@','') as game_location, CASE
  WHEN st.team_id = sup_games.home_team_id THEN IFNULL(home_score,0) - IFNULL(away_score,0) + IFNULL(home_score,0)/100
  WHEN st.team_id = sup_games.away_team_id THEN IFNULL(away_score,0) - IFNULL(home_score,0) + IFNULL(away_score,0)/100
  WHEN home_score = away_score THEN IFNULL(home_score,0) - IFNULL(away_score,0) + IFNULL(home_score,0)/100
  ELSE 0 END
  as game_result_csk, CONCAT(
  CASE
  WHEN st.team_id = sup_games.home_team_id AND home_score > away_score THEN CONCAT('W, ',home_score,'-',away_score)
  WHEN st.team_id = sup_games.away_team_id AND home_score < away_score THEN CONCAT('W, ',away_score,'-',home_score)
  WHEN st.team_id = sup_games.home_team_id AND home_score < away_score THEN CONCAT('L, ',home_score,'-',away_score)
  WHEN st.team_id = sup_games.away_team_id AND home_score > away_score THEN CONCAT('L, ',away_score,'-',home_score)
  WHEN home_score = away_score THEN CONCAT('T, ',home_score,'-',away_score)
  ELSE '' END,
  IF( scheduled_innings != 9 OR outs_played < 6*IFNULL(scheduled_innings,9)-3 OR outs_played > 6*IFNULL(scheduled_innings,9),
  CONCAT(" (", CEIL(outs_played / 6), ")"),
  ""
  )
  )
  as game_result, os.name_abbr as opp_name_abbr, 	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,      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 sup_games USING (game_id)
  JOIN sup_people USING (person_id)
  JOIN sup_players USING (person_id)
  JOIN (SELECT game_id, year_id, comp_id, phase_id, part_id, team_id, opp_team_id, opp_comp_id, opp_phase_id, team_game_num_season, home_away_neutral, win, loss, tie FROM sup_team_games) as tg USING (game_id, team_id)
  JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
  JOIN sup_comp_seasons USING (comp_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 (SELECT team_id as opp_team_id, year_id, name_abbr, link as opp_team_link FROM sup_team_seasons GROUP BY team_id, year_id ) as os USING (opp_team_id, year_id)
WHERE ((person_id=?))
  AND opp_team_id=?
  AND type="reg" 
ORDER BY date DESC LIMIT 0, 20

SQL PARAMS -- $VAR1 = [
          'otani-000sho',
          'BOS'
        ];

Query Time: 0.05 seconds
SELECT age_on_day, ts.name_abbr as team_name_abbr, ts.link as team_link, opp_team_link, CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, game_id, sup_games.link as game_link, year_id as year_id_csk, year_id as year_id, IF(home_away_neutral = 'a','@','') as game_location, CASE
  WHEN st.team_id = sup_games.home_team_id THEN IFNULL(home_score,0) - IFNULL(away_score,0) + IFNULL(home_score,0)/100
  WHEN st.team_id = sup_games.away_team_id THEN IFNULL(away_score,0) - IFNULL(home_score,0) + IFNULL(away_score,0)/100
  WHEN home_score = away_score THEN IFNULL(home_score,0) - IFNULL(away_score,0) + IFNULL(home_score,0)/100
  ELSE 0 END
  as game_result_csk, CONCAT(
  CASE
  WHEN st.team_id = sup_games.home_team_id AND home_score > away_score THEN CONCAT('W, ',home_score,'-',away_score)
  WHEN st.team_id = sup_games.away_team_id AND home_score < away_score THEN CONCAT('W, ',away_score,'-',home_score)
  WHEN st.team_id = sup_games.home_team_id AND home_score < away_score THEN CONCAT('L, ',home_score,'-',away_score)
  WHEN st.team_id = sup_games.away_team_id AND home_score > away_score THEN CONCAT('L, ',away_score,'-',home_score)
  WHEN home_score = away_score THEN CONCAT('T, ',home_score,'-',away_score)
  ELSE '' END,
  IF( scheduled_innings != 9 OR outs_played < 6*IFNULL(scheduled_innings,9)-3 OR outs_played > 6*IFNULL(scheduled_innings,9),
  CONCAT(" (", CEIL(outs_played / 6), ")"),
  ""
  )
  )
  as game_result, os.name_abbr as opp_name_abbr, 	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,      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 sup_games USING (game_id)
  JOIN sup_people USING (person_id)
  JOIN sup_players USING (person_id)
  JOIN (SELECT game_id, year_id, comp_id, phase_id, part_id, team_id, opp_team_id, opp_comp_id, opp_phase_id, team_game_num_season, home_away_neutral, win, loss, tie FROM sup_team_games) as tg USING (game_id, team_id)
  JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
  JOIN sup_comp_seasons USING (comp_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 (SELECT team_id as opp_team_id, year_id, name_abbr, link as opp_team_link FROM sup_team_seasons GROUP BY team_id, year_id ) as os USING (opp_team_id, year_id)
WHERE ((person_id=?))
  AND opp_team_id=?
  AND type="post" 
ORDER BY date DESC LIMIT 0, 20

SQL PARAMS -- $VAR1 = [
          'otani-000sho',
          'BOS'
        ];

Query Time: 0.01 seconds
Table Build Time: 0.06 seconds


--------------------------------------

bvp_sum_p

Page Setup Time: 0.00135 seconds

SELECT year_game as event_year_id, name_display, name_display_csk, CONCAT("/baseball/versus-finder.cgi?request=1&player_id1=",batter_id,"&player_id2=",pitcher_id,"") as name_display_link, 1 as name_display_link_no_full, "reg" as type, current_team, UPPER(SUBSTRING(throws,1,1)) AS throws, SUM(PA) AS b_pa, SUM(AB) AS b_ab, SUM(H) AS b_h, SUM(2B) AS b_doubles, SUM(3B) AS b_triples, SUM(HR) AS b_hr, SUM(RBI) AS b_rbi, SUM(BB) AS b_bb, SUM(SO) AS b_so, SUM(H)/SUM(AB) as b_batting_avg_csk, TRIM(LEADING '0' FROM ROUND(SUM(H)/SUM(AB),3)) AS b_batting_avg, (SUM(H) + SUM(BB) + SUM(HBP)) / (SUM(AB) + SUM(BB) + SUM(HBP) + SUM(SF)) as b_onbase_perc_csk, TRIM(LEADING '0' FROM ROUND((SUM(H) + SUM(BB) + SUM(HBP)) / (SUM(AB) + SUM(BB) + SUM(HBP) + SUM(SF)),3)) AS b_onbase_perc, (SUM(H) + SUM(2B) + (SUM(3B)*2) + (SUM(HR)*3)) / SUM(AB) as b_slugging_perc_csk, TRIM(LEADING '0' FROM ROUND((SUM(H) + SUM(2B) + (SUM(3B)*2) + (SUM(HR)*3)) / SUM(AB),3)) AS b_slugging_perc, ((SUM(H) + SUM(BB) + SUM(HBP)) / (SUM(AB) + SUM(BB) + SUM(HBP) + SUM(SF))) + ((SUM(H) + SUM(2B) + (SUM(3B)*2) + (SUM(HR)*3)) / SUM(AB)) as b_onbase_plus_slugging_csk, TRIM(LEADING '0' FROM ROUND(((SUM(H) + SUM(BB) + SUM(HBP)) / (SUM(AB) + SUM(BB) + SUM(HBP) + SUM(SF))) + ((SUM(H) + SUM(2B) + (SUM(3B)*2) + (SUM(HR)*3)) / SUM(AB)),3)) AS b_onbase_plus_slugging, SUM(SH) AS b_sh, SUM(SF) AS b_sf, SUM(IBB) AS b_ibb, SUM(HBP) AS b_hbp, SUM(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
  LEFT JOIN (SELECT franch_ID as current_team, player_ID FROM __mlbam_rosters WHERE is_roster_mlb="Y"
  AND status_code="A"
  AND level_id="mlb"  ) as rost ON player_ID=result_pitcher
  JOIN sup_players ON pitcher_id=person_id
  JOIN sup_people USING (person_id)
  JOIN (SELECT is_active, person_id FROM sup_players) as bmeta ON batter_id=bmeta.person_id
WHERE bmeta.is_active=1
  AND ((batter_id=?)) 
GROUP BY pitcher_id
HAVING current_team=?
ORDER BY b_pa DESC 

SQL PARAMS -- $VAR1 = [
          'otani-000sho',
          'BOS'
        ];

Query Time: 0.04 seconds
Table Build Time: 0.04 seconds


--------------------------------------

pvt_totals_samepos

Page Setup Time: 0.00154 seconds

SELECT year_id as year_id_csk, year_id as year_id, GROUP_CONCAT(DISTINCT CONCAT('<a href="', 'DOMAIN', ts.link, '" target="_blank">', ts.name_abbr, '</a>')) as teams_played_for, COUNT(*) AS 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_h - (b_doubles + b_triples + b_hr)) AS b_singles, 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, phase_id FROM sup_team_seasons) as ts USING (team_id, year_id, phase_id)
WHERE ((person_id=?))
  AND opp_team_id=?
  AND type="reg" 
GROUP BY year_id
ORDER BY year_id LIMIT 0, 200

SQL PARAMS -- $VAR1 = [
          'otani-000sho',
          'BOS'
        ];

Query Time: 0.03 seconds
SELECT year_id as year_id_csk, year_id as year_id, GROUP_CONCAT(DISTINCT CONCAT('<a href="', 'DOMAIN', ts.link, '" target="_blank">', ts.name_abbr, '</a>')) as teams_played_for, COUNT(*) AS 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_h - (b_doubles + b_triples + b_hr)) AS b_singles, 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, phase_id FROM sup_team_seasons) as ts USING (team_id, year_id, phase_id)
WHERE ((person_id=?))
  AND opp_team_id=?
  AND type="post" 
GROUP BY year_id
ORDER BY year_id LIMIT 0, 200

SQL PARAMS -- $VAR1 = [
          'otani-000sho',
          'BOS'
        ];

Query Time: 0.01 seconds
Table Build Time: 0.04 seconds


--------------------------------------

pvt_gamelogs_samepos

Page Setup Time: 0.00331 seconds

SELECT age_on_day, ts.name_abbr as team_name_abbr, ts.link as team_link, opp_team_link, CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, game_id, sup_games.link as game_link, year_id as year_id_csk, year_id as year_id, IF(home_away_neutral = 'a','@','') as game_location, CASE
  WHEN st.team_id = sup_games.home_team_id THEN IFNULL(home_score,0) - IFNULL(away_score,0) + IFNULL(home_score,0)/100
  WHEN st.team_id = sup_games.away_team_id THEN IFNULL(away_score,0) - IFNULL(home_score,0) + IFNULL(away_score,0)/100
  WHEN home_score = away_score THEN IFNULL(home_score,0) - IFNULL(away_score,0) + IFNULL(home_score,0)/100
  ELSE 0 END
  as game_result_csk, CONCAT(
  CASE
  WHEN st.team_id = sup_games.home_team_id AND home_score > away_score THEN CONCAT('W, ',home_score,'-',away_score)
  WHEN st.team_id = sup_games.away_team_id AND home_score < away_score THEN CONCAT('W, ',away_score,'-',home_score)
  WHEN st.team_id = sup_games.home_team_id AND home_score < away_score THEN CONCAT('L, ',home_score,'-',away_score)
  WHEN st.team_id = sup_games.away_team_id AND home_score > away_score THEN CONCAT('L, ',away_score,'-',home_score)
  WHEN home_score = away_score THEN CONCAT('T, ',home_score,'-',away_score)
  ELSE '' END,
  IF( scheduled_innings != 9 OR outs_played < 6*IFNULL(scheduled_innings,9)-3 OR outs_played > 6*IFNULL(scheduled_innings,9),
  CONCAT(" (", CEIL(outs_played / 6), ")"),
  ""
  )
  )
  as game_result, os.name_abbr as opp_name_abbr, 	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, 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
FROM sup_player_games as st
  JOIN sup_games USING (game_id)
  JOIN sup_people USING (person_id)
  JOIN sup_players USING (person_id)
  JOIN (SELECT game_id, year_id, comp_id, phase_id, part_id, team_id, opp_team_id, opp_comp_id, opp_phase_id, team_game_num_season, home_away_neutral, win, loss, tie FROM sup_team_games) as tg USING (game_id, team_id)
  JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
  JOIN sup_comp_seasons USING (comp_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 (SELECT team_id as opp_team_id, year_id, name_abbr, link as opp_team_link FROM sup_team_seasons GROUP BY team_id, year_id ) as os USING (opp_team_id, year_id)
WHERE ((person_id=?))
  AND opp_team_id=?
  AND type="reg" 
ORDER BY date DESC LIMIT 0, 20

SQL PARAMS -- $VAR1 = [
          'otani-000sho',
          'BOS'
        ];

Query Time: 0.05 seconds
SELECT age_on_day, ts.name_abbr as team_name_abbr, ts.link as team_link, opp_team_link, CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, game_id, sup_games.link as game_link, year_id as year_id_csk, year_id as year_id, IF(home_away_neutral = 'a','@','') as game_location, CASE
  WHEN st.team_id = sup_games.home_team_id THEN IFNULL(home_score,0) - IFNULL(away_score,0) + IFNULL(home_score,0)/100
  WHEN st.team_id = sup_games.away_team_id THEN IFNULL(away_score,0) - IFNULL(home_score,0) + IFNULL(away_score,0)/100
  WHEN home_score = away_score THEN IFNULL(home_score,0) - IFNULL(away_score,0) + IFNULL(home_score,0)/100
  ELSE 0 END
  as game_result_csk, CONCAT(
  CASE
  WHEN st.team_id = sup_games.home_team_id AND home_score > away_score THEN CONCAT('W, ',home_score,'-',away_score)
  WHEN st.team_id = sup_games.away_team_id AND home_score < away_score THEN CONCAT('W, ',away_score,'-',home_score)
  WHEN st.team_id = sup_games.home_team_id AND home_score < away_score THEN CONCAT('L, ',home_score,'-',away_score)
  WHEN st.team_id = sup_games.away_team_id AND home_score > away_score THEN CONCAT('L, ',away_score,'-',home_score)
  WHEN home_score = away_score THEN CONCAT('T, ',home_score,'-',away_score)
  ELSE '' END,
  IF( scheduled_innings != 9 OR outs_played < 6*IFNULL(scheduled_innings,9)-3 OR outs_played > 6*IFNULL(scheduled_innings,9),
  CONCAT(" (", CEIL(outs_played / 6), ")"),
  ""
  )
  )
  as game_result, os.name_abbr as opp_name_abbr, 	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, 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
FROM sup_player_games as st
  JOIN sup_games USING (game_id)
  JOIN sup_people USING (person_id)
  JOIN sup_players USING (person_id)
  JOIN (SELECT game_id, year_id, comp_id, phase_id, part_id, team_id, opp_team_id, opp_comp_id, opp_phase_id, team_game_num_season, home_away_neutral, win, loss, tie FROM sup_team_games) as tg USING (game_id, team_id)
  JOIN sup_phase_seasons USING (comp_id, phase_id, year_id)
  JOIN sup_comp_seasons USING (comp_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 (SELECT team_id as opp_team_id, year_id, name_abbr, link as opp_team_link FROM sup_team_seasons GROUP BY team_id, year_id ) as os USING (opp_team_id, year_id)
WHERE ((person_id=?))
  AND opp_team_id=?
  AND type="post" 
ORDER BY date DESC LIMIT 0, 20

SQL PARAMS -- $VAR1 = [
          'otani-000sho',
          'BOS'
        ];

Query Time: 0.01 seconds
Table Build Time: 0.06 seconds


--------------------------------------
SH->PARAM -- $VAR1 = {
          't2yrto' => 2025,
          'player_id1' => 'otani-000sho',
          'match' => 'versus_playervteam',
          't1yrto' => 2025,
          'team_id1' => 'BOS'
        };
SH->PARAM_NO_DEFAULT -- $VAR1 = {
          'team_id1' => 'BOS',
          'player_id1' => 'otani-000sho',
          'match' => 'versus_playervteam'
        };
Show Criteria
Share Results

Search Criteria

Seasons
Player 1
Javascript is required for the selection of a player.
Choice is: Shohei Ohtani 
Team 1
Team 2

You have edited your search criteria

or keep editing your search

clear changes

Fetching Results

Stathead spinner

Shohei Ohtani vs. Boston Red Sox

Regular Season: 35 GP, 25.0 IP, 3-1 W-L, 0 SV, 2.52 ERA, 25 SO, 5 BB

Playoffs: 0 GP

Shohei Ohtani vs. Boston Red Sox: Pitching

Shohei Ohtani vs. Boston Red Sox: Current Batters

Shohei Ohtani vs. Boston Red Sox: Totals

Shohei Ohtani vs. Boston Red Sox: Game Logs

Subscribe to Stathead Baseball for full results.

Go inside the Baseball Reference database and access the sports search engine that was made for fans like you. Subscriptions start at just $9/month. Learn More.

Get your first month FREE

Already a paid subscriber? Log in for full results.

Shohei Ohtani vs. Boston Red Sox: Batting

Shohei Ohtani vs. Boston Red Sox: Current Pitchers

Shohei Ohtani vs. Boston Red Sox: Totals

Shohei Ohtani vs. Boston Red Sox: Game Logs

Subscribe to Stathead Baseball for full results.

Go inside the Baseball Reference database and access the sports search engine that was made for fans like you. Subscriptions start at just $9/month. Learn More.

Get your first month FREE

Already a paid subscriber? Log in for full results.

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.

If you utilize material unique to a Sports Reference site for a tweet, an article, or for research for a broadcast or podcast, please strongly consider citing this site as the source for the material. It would be greatly appreciated and would help us continue to produce this material.