Advertisement
TheFan1968

Converting Results from Contao-Plugin to FassHockeyCms JSON

Feb 1st, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.53 KB | None | 0 0
  1. INSERT INTO fhc_hockey_league_results (schedule_id,result,result_comment)
  2. SELECT
  3.   sch.schedule_id,
  4.   concat('{ "h":',substr(tmp.score_end,1,locate(':',tmp.score_end)-1)
  5.           ,', "g":',substr(tmp.score_end,locate(':',tmp.score_end)+1)
  6.           ,', "h1":',substr(tmp.score_first,1,locate(':',tmp.score_first)-1)
  7.           ,', "g1":',substr(tmp.score_first,locate(':',tmp.score_first)+1)
  8.           ,', "h2":',substr(tmp.score_second,1,locate(':',tmp.score_second)-1)
  9.           ,', "g2":',substr(tmp.score_second,locate(':',tmp.score_second)+1)
  10.           ,', "h3":',substr(tmp.score_third,1,locate(':',tmp.score_third)-1)
  11.           ,', "g3":',substr(tmp.score_third,locate(':',tmp.score_third)+1)
  12.           ,', "hot":',substr(tmp.score_ot,1,locate(':',tmp.score_ot)-1)
  13.           ,', "got":',substr(tmp.score_ot,locate(':',tmp.score_ot)+1)
  14.           ,', "hp":',substr(tmp.score_pen,1,locate(':',tmp.score_pen)-1)
  15.           ,', "gp":',substr(tmp.score_pen,locate(':',tmp.score_pen)+1),' }'
  16.         ) as result,
  17.   concat(hc.club_name,' - ',ac.club_name) AS result_comment
  18.   FROM fhc_hockey_league_schedule sch
  19.   JOIN fhc_hockey_club_team hct
  20.     ON hct.team_id = sch.home_team_id
  21.   JOIN fhc_hockey_club_team act
  22.     ON act.team_id = sch.away_team_id
  23.   JOIN fhc_hockey_club hc
  24.     ON hc.club_id = hct.club_id
  25.   JOIN fhc_hockey_club ac
  26.     ON ac.club_id = act.club_id
  27.   JOIN tmp_termine tmp
  28.     ON tmp.datum = sch.datum
  29.     AND tmp.zeit = sch.zeit
  30.     AND tmp.home = hc.club_name
  31.     AND tmp.away = ac.club_name
  32. WHERE tmp.score_end !=""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement