Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 1.88 KB  |  views: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. SELECT
  2.   DISTINCT
  3.   af.a_ftv_market                                            market,
  4.   af.a_ftv_channel                                          channel,
  5.   ac.a_champion_season                                        season,
  6.   ac.a_champion_round                                          ROUND,
  7.   ac.a_champion_match                                          "match",
  8.   ac.a_champion_quarter_1_start                                    match_started_at,
  9.   af.a_ftv_episode_start                                        episode_started_at,
  10.   af.a_ftv_episode_home_team                                      home_team,
  11.   af.a_ftv_episode_away_team                                      away_team,                          
  12.   af.a_ftv_episode_capture_time - (af.a_ftv_episode_start - ac.a_champion_quarter_1_start)      ratings_captured_at,
  13.   ac.a_champion_score_time                                      score_captured_at,
  14.   ac.a_champion_stadium                                        played_at,
  15.   ac.a_champion_attendance                                      number_in_attendance,
  16.   ac.a_champion_home_points                                      home_score_this_minute,
  17.   ac.a_champion_away_points                                      away_score_this_minute
  18. FROM  
  19.  
  20.   a_ftv        af LEFT OUTER JOIN a_champion      ac
  21.  
  22.   ON to_char(af.a_ftv_episode_start, 'yyyy-mm-dd')   =   to_char(ac.a_champion_quarter_1_start, 'yyyy-mm-dd')
  23.  
  24.   AND af.a_ftv_episode_home_team          =  ac.a_champion_home_team
  25.   AND af.a_ftv_episode_away_team          =  ac.a_champion_away_team  
  26.   AND  af.a_ftv_episode_capture_time - (af.a_ftv_episode_start - ac.a_champion_quarter_1_start)  =  ac.a_champion_score_time
  27.   WHERE  ac.a_champion_season            =  2009
  28.   AND  ac.a_champion_round              =  2
  29.  
  30. ORDER BY
  31.   market,
  32.   season,
  33.   ROUND,
  34.   "match",
  35.   match_started_at,
  36.   episode_started_at