Team Pitching Span Stats Finder - Baseball

Find the best (or worst) spans for any number of games matching your criteria. • Sample SearchesData Coverage
In a span of 5 games, in 2025, in the regular season, sorted by descending Strikeouts.
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 »
--------------------------------------

main

Page Setup Time: 0.00151 seconds

WITH
  Gamelog AS (
SELECT year_id, team_id, FIRST_VALUE(IF(date_game_number,CONCAT(date," (",date_game_number,")"),date)) OVER w as span_start_date_window, LAST_VALUE(IF(date_game_number,CONCAT(date," (",date_game_number,")"),date)) OVER w as span_end_date_window, ROW_NUMBER() OVER w AS rn, COUNT(*) OVER w AS played_in_span, CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),"")) as date, team_game_num_franchise, phase_id, SUM(p_so) OVER w AS p_so
FROM sup_team_games as st
  JOIN sup_games USING (game_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)
WHERE year_id>=?
  AND sup_phase_seasons.type=?
  AND forfeit IS NULL
  AND date < current_date() 
WINDOW w AS (PARTITION BY team_id ORDER BY date, date_game_number ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) 
  ),
  span_list AS (
SELECT team_id, played_in_span, span_start_date_window as span_start_date, span_end_date_window as span_end_date
FROM Gamelog
WHERE played_in_span=? 
ORDER BY p_so DESC, span_start_date DESC LIMIT 0, 20
  )
SELECT ts.name_abbr as team_name_abbr, ts.link as team_link, team_id, span_start_date as span_start_date_csk, span_start_date as span_start_date, span_end_date as span_end_date_csk, span_end_date as span_end_date, 'Games List' as details_games, COUNT(*) AS b_games, SUM(win=1) AS wins, SUM(loss=1) AS losses, SUM(win)/(SUM(win+loss)) as team_win_loss_perc_csk, TRIM(LEADING '0' FROM ROUND(SUM(win)/(SUM(win+loss)),3)) AS team_win_loss_perc, 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_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, SUM(p_s) AS p_s, SUM(p_cg) AS p_cg, SUM(p_sho) AS p_sho
FROM span_list
  JOIN sup_team_games as st USING (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 sup_games USING (game_id)
WHERE sup_phase_seasons.type=?
  AND CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),""))>=span_start_date
  AND CONCAT(`date`,IF(date_game_number,CONCAT(" (",date_game_number,")"),""))<=span_end_date
  AND forfeit IS NULL 
GROUP BY team_id, span_start_date, span_end_date
ORDER BY p_so DESC, span_start_date_csk DESC, team_id 

SQL PARAMS -- $VAR1 = [
          2025,
          'reg',
          5,
          'reg'
        ];

Query Time: 3.12 seconds
Table Build Time: 0.05 seconds


--------------------------------------
SH->PARAM -- $VAR1 = {
          'year_min' => 2025,
          'comp_type' => 'reg',
          'year_max' => 2025,
          'order_by' => 'p_so',
          'max_temperature' => 120,
          'max_wind_speed' => 90,
          'match' => 'team_span_game',
          'span_length' => 5,
          'timeframe' => 'seasons'
        };
SH->PARAM_NO_DEFAULT -- $VAR1 = {
          'year_min' => 2025,
          'year_max' => 2025
        };

Search Criteria

Click on the red text to pre-fill the form with various values

Sort By
Sorting options are only available for subscribers. Sign up now for a free trial.
Timeframe
Your search is currently looking for the individual games in the chosen span of days or seasons. You can also Switch to the search for totals from all games.
Your search is currently looking for the total of all games in the chosen span of days or seasons.
When searching spans for all teams and players, we recommend limiting selected seasons to 10 or fewer to reduce likelihood of timeout errors.
Game Type
Series/Game
Span Length
Games
Span Options

Statistical Filters (IP, R, BB, SO, etc.)

x

Team Filters (League, Team, Result, etc.)

Team
League

Note: Negro League game-level data is not yet available. See coverage note.

Team Success

Based on team's finish at the end of the season. For combined season searches, only the seasons that match criteria are included in results. "By Division Finish" will use Conference or League finish when Division is not relevant.

Game Filters (Opponent, Location, etc.)

Opponent
Opponent's League

Note: Negro League game-level data is not yet available. See coverage note.

Game Result
Game Location
Ballpark
Game Length
Interleague Games
DH Rule in Effect
Temperature
to
Wind Speed
to
Wind Direction
Precipitation
Sky
Day or Night

You have edited your search criteria

or keep editing your search

clear changes

Fetching Results

Stathead spinner

Please note that Span Finder searches are particularly data intensive and can take up to 1-2 minutes to complete

Query Results

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: 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.