Latest News: OOTP 13 Announced with Screenshots & Feature List! Pre-Order Now! - OOTP Baseball 12 Available! - iOOTP Baseball 2011 Available! - Title Bout Championship Boxing 2.5 released! - Inside the Park Baseball Patch 1.03 released, DEMO now available

Pre-Order OOTP 13, Save & Win! | OOTP 12 Off-Season Special, just $19.99!

Go Back   OOTP Developments Forums > Out of the Park Baseball 10 > OOTP 10 - General Discussions

Reply
 
LinkBack Thread Tools Display Modes
Old 09-03-2009, 12:30 PM   #1 (permalink)
Major Leagues
 
wellsoliver's Avatar
 
Join Date: Aug 2009
Location: San Diego, CA
Posts: 317
Thanked 19x in 15 posts
mysql exports- determing pre/regular/post/off season status?

Is there a way in the league exports (mysql) to determine if you're currently in the pre/regular/post/off season?
wellsoliver is offline   Reply With Quote
Old 09-03-2009, 03:00 PM   #2 (permalink)
BMW
All Star Starter
 
BMW's Avatar
 
Join Date: May 2003
Location: New Jersey
Posts: 1,471
Thanked 491x in 204 posts
This will create a results set with four columns: league_id, SeasonStatus, ExhibitionStatus and AllStarStatus.

Season Status will have either:
  • Offseason
  • Postseason
  • Regular Season
  • Preseason
  • Spring Training
Exhibition Status will have:
  • No Exhibition Games Scheduled
  • Exhibition Games Remaining
  • All Exhibition Games Finished
All Star Status will have:
  • No All Star Game Scheduled
  • Before All Star Break
  • After All Star Break

Code:
SELECT L.league_id, 

CASE 
WHEN post.Ct IS NOT NULL AND postexists.Ct IS NULL THEN 'Offseason' 
WHEN post.Ct IS NULL AND postexists.Ct IS NULL AND reg.Ct IS NOT NULL AND regexists.Ct IS NULL THEN 'Offseason' 
WHEN post.Ct IS NOT NULL AND postexists.Ct IS NOT NULL THEN 'Postseason' 
WHEN reg.Ct IS NOT NULL AND regexists.Ct IS NOT NULL THEN 'Regular Season' 
WHEN spr.Ct IS NULL AND springexists.Ct IS NULL THEN 'Preseason' 
WHEN spr.Ct IS NOT NULL THEN 'Spring Training' 
ELSE 'Preseason' END AS SeasonStatus,

CASE 
WHEN exibitionexists.Ct IS NULL AND exibition.Ct IS NULL THEN 'No Exhibition Games Scheduled'
WHEN exibitionexists.Ct IS NOT NULL AND exibition.Ct IS NOT NULL THEN 'Exhibition Games Remaining'
ELSE 'All Exhibition Games Finished' END AS ExhibitionStatus,

CASE 
WHEN allstarexists.Ct IS NULL AND allstar.Ct IS NULL THEN 'No All Star Game Scheduled'
WHEN allstarexists.Ct IS NOT NULL AND allstar.Ct IS NOT NULL THEN 'Before All Star Break'
ELSE 'After All Star Break' END AS AllStar_Status

FROM leagues L 

LEFT JOIN (SELECT g.league_id, COUNT(g.game_id) as Ct FROM games g WHERE g.played = 1 AND g.game_type = 0 GROUP BY g.league_id) AS reg ON L.league_id = reg.league_id 

LEFT JOIN (SELECT g.league_id, COUNT(g.game_id) as Ct FROM games g WHERE g.played = 1 AND g.game_type = 1 GROUP BY g.league_id) AS exibition ON L.league_id = exibition.league_id 

LEFT JOIN (SELECT g.league_id, COUNT(g.game_id) as Ct FROM games g WHERE g.played = 1 AND g.game_type = 2 GROUP BY g.league_id) AS spr ON L.league_id = spr.league_id 

LEFT JOIN (SELECT g.league_id, COUNT(g.game_id) as Ct FROM games g WHERE g.played = 1 AND g.game_type = 3 GROUP BY g.league_id) AS post ON L.league_id = post.league_id 

LEFT JOIN (SELECT g.league_id, COUNT(g.game_id) as Ct FROM games g WHERE g.played = 1 AND g.game_type = 4 GROUP BY g.league_id) AS allstar ON L.league_id = allstar.league_id 

LEFT JOIN (SELECT g.league_id, COUNT(g.game_id) as Ct FROM games g WHERE g.played = 0 AND g.game_type = 4 GROUP BY g.league_id) AS allstarexists ON L.league_id = allstarexists.league_id 

LEFT JOIN (SELECT g.league_id, COUNT(g.game_id) as Ct FROM games g WHERE g.played = 0 AND g.game_type = 3 GROUP BY g.league_id) AS postexists ON L.league_id = postexists.league_id 

LEFT JOIN (SELECT g.league_id, COUNT(g.game_id) as Ct FROM games g WHERE g.played = 0 AND g.game_type = 2 GROUP BY g.league_id) AS springexists ON L.league_id = springexists.league_id 

LEFT JOIN (SELECT g.league_id, COUNT(g.game_id) as Ct FROM games g WHERE g.played = 0 AND g.game_type = 1 GROUP BY g.league_id) AS exibitionexists ON L.league_id = exibitionexists.league_id 

LEFT JOIN (SELECT g.league_id, COUNT(g.game_id) as Ct FROM games g WHERE g.played = 0 AND g.game_type = 0 GROUP BY g.league_id) AS regexists ON L.league_id = regexists.league_id
BMW is offline   Reply With Quote
Thank you for this post:
wellsoliver (09-03-2009)
Old 09-03-2009, 03:33 PM   #3 (permalink)
Major Leagues
 
wellsoliver's Avatar
 
Join Date: Aug 2009
Location: San Diego, CA
Posts: 317
Thanked 19x in 15 posts
Awesome, thanks. Sadly, though, I think it's a known issue that the league table from which yr query derives its stuff doesn't have a properly generated export- it's missing data. I guess I could go in and add the missing data (I think it's colors). I'll just go do that
wellsoliver is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:05 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0
Copyright © 2009 Out of the Park Developments