SELECT games.*, SUBSTRING(sked,1,10) as skeddate, arenas.ID as arenaID, arenas.name as arenaname, arenas.location, arenas.rinkAtlasID, IFNULL((SELECT commonName FROM chnews_chbase.schoolYxY_new WHERE school_ID=homeID AND games.season=schoolYxY_new.season),(SELECT briefname FROM chnews_chbase.teams_other WHERE code=homeID)) as homename, IFNULL((SELECT commonName FROM chnews_chbase.schoolYxY_new WHERE school_ID=visID AND games.season=schoolYxY_new.season),(SELECT briefname FROM chnews_chbase.teams_other WHERE code=visID)) as visname FROM chnews_gd.games JOIN chnews_chbase.conf ON conf.ID=games.confID LEFT JOIN chnews_chbase.arenas ON arenaID=arenas.ID WHERE games.season=20162017 AND DATE_FORMAT(sked,'%Y%m%d')>='20130511' AND DATE_FORMAT(sked,'%Y%m%d')<='20130511' ORDER BY skeddate, priority, games.confID, tournID