Bryce Harper vs. Los Angeles Angels
--------------------------------------
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(b_hr) AS b_hr, SUM(b_rbi) AS b_rbi, SUM(b_doubles) AS b_doubles, SUM(b_sb) AS b_sb
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(b_hr) AS b_hr, SUM(b_rbi) AS b_rbi, SUM(b_doubles) AS b_doubles, SUM(b_sb) AS b_sb
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.b_hr AS rspvt_b_hr, popvt.b_hr AS popvt_b_hr, rspvt.b_rbi AS rspvt_b_rbi, popvt.b_rbi AS popvt_b_rbi, rspvt.b_doubles AS rspvt_b_doubles, popvt.b_doubles AS popvt_b_doubles, rspvt.b_sb AS rspvt_b_sb, popvt.b_sb AS popvt_b_sb
FROM rspvt
JOIN popvt
WHERE 1 LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'harper002bry',
'ANA',
'harper002bry',
'ANA'
];
--------------------------------------
bvp_sum_p
Page Setup Time: 0.00185 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 = [
'harper002bry',
'ANA'
];
Query Time: 0.10 seconds
Table Build Time: 0.05 seconds
--------------------------------------
pvt_totals
Page Setup Time: 0.00201 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 = [
'harper002bry',
'ANA'
];
Query Time: 0.05 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 = [
'harper002bry',
'ANA'
];
Query Time: 0.02 seconds
Table Build Time: 0.05 seconds
--------------------------------------
pvt_gamelogs
Page Setup Time: 0.00188 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 = [
'harper002bry',
'ANA'
];
Query Time: 0.10 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 = [
'harper002bry',
'ANA'
];
Query Time: 0.03 seconds
Table Build Time: 0.07 seconds
--------------------------------------
bvp_sum_b
Page Setup Time: 0.00158 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 = [
'harper002bry',
'ANA'
];
Query Time: 0.00 seconds
--------------------------------------
pvt_totals_samepos
Page Setup Time: 0.00184 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
HAVING p_bfp>0
ORDER BY year_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'harper002bry',
'ANA'
];
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
HAVING p_bfp>0
ORDER BY year_id LIMIT 0, 200
SQL PARAMS -- $VAR1 = [
'harper002bry',
'ANA'
];
Query Time: 0.02 seconds
--------------------------------------
pvt_gamelogs_samepos
Page Setup Time: 0.00294 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"
HAVING p_bfp>0
ORDER BY date DESC LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'harper002bry',
'ANA'
];
Query Time: 0.09 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"
HAVING p_bfp>0
ORDER BY date DESC LIMIT 0, 20
SQL PARAMS -- $VAR1 = [
'harper002bry',
'ANA'
];
Query Time: 0.03 seconds
--------------------------------------
SH->PARAM -- $VAR1 = {
'team_id1' => 'ANA',
't1yrto' => 2025,
't2yrto' => 2025,
'player_id1' => 'harper002bry',
'match' => 'versus_playervteam'
};
SH->PARAM_NO_DEFAULT -- $VAR1 = {
'player_id1' => 'harper002bry',
'match' => 'versus_playervteam',
'team_id1' => 'ANA'
};
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.