All pastes #985359 Raw Edit

fantasy

public text v1 · immutable
·published 2008-04-14 23:09 UTC
rendered paste body
SELECT `p`.`person_key`,  `e`.`event_key`,
	`e`.`event_status`,
	`bps`.`strikeouts`,
	`bps`.`innings_pitched`,
	`bps`.`wins`,
	`bps`.`hits`,
	`bps`.`balks`,
	`bps`.`earned_runs`
FROM `persons` AS `p`
 INNER JOIN `person_event_metadata` AS `pem` ON pem.person_id = p.id
 INNER JOIN `events` AS `e` ON pem.event_id = e.id
 INNER JOIN `affiliations_events` AS `ae` ON ae.event_id = e.id
 INNER JOIN `affiliations` AS `a` ON a.id = ae.affiliation_id
 INNER JOIN `stats` AS `s` ON s.stat_coverage_id = e.id AND s.stat_holder_id = p.id
 INNER JOIN `baseball_pitching_stats` AS `bps` ON s.stat_repository_id = bps.id
WHERE
	(e.event_status = 'post-event')
	AND (a.affiliation_key = 'l.mlb.com')
	AND (a.publisher_id = '1')
	AND (s.stat_repository_type = 'baseball_pitching_stats')
	AND (s.stat_coverage_type = 'events')
	AND (s.stat_holder_type = 'persons')
	AND (s.context = 'event')
	AND (e.start_date_time > '2008-04-11 00:00:00')
	AND (e.start_date_time <= '2008-04-11 23:59:59')
	AND (p.person_key = 'l.mlb.com-p.13453')