Error in query:
SELECT
fixture_grid.week AS week,
DATE_FORMAT(DATE_ADD(fixture_grid.week, INTERVAL home_team.date_offset DAY), '%d-%b-%y') AS scheduled,
CASE DAYOFWEEK(DATE_ADD(fixture_grid.week, INTERVAL home_team.date_offset DAY))
WHEN 2 THEN 'Mon'
WHEN 3 THEN 'Tue'
WHEN 4 THEN 'Wed'
WHEN 5 THEN 'Thu'
WHEN 6 THEN 'Fri' END AS day,
IF(home_team.name = 'RAL D','H','A') AS venue,
IF( home_team.name = 'RAL D', away_team.name, home_team.name) AS opponent
FROM FIXTURE_GRID AS fixture_grid INNER JOIN TEAM AS home_team ON fixture_grid.home = home_team.number
INNER JOIN TEAM AS away_team ON fixture_grid.away = away_team.number
WHERE
(home_team.name = 'RAL D' OR away_team.name = 'RAL D')
AND home_team.division =
AND away_team.division =
ORDER BY DATE_ADD(fixture_grid.week, INTERVAL home_team.date_offset DAY). You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND away_team.division =
ORDER BY DATE_ADD(fixture_grid.week, INTERVAL home_' at line 17