夜遅くまでレッスン受講が可能なオンライン英会話スクール

MySQLでエラーが発生しました。
SELECT *,sum(bit) as rank FROM eikaiwa_school LEFT JOIN eikaiwa_ad ON eikaiwa_school.id=eikaiwa_ad.school_id WHERE stype like '%深夜%' and ('2021-10-26' <= end and '2021-10-26' >= eikaiwa_ad.start) and id <> '4' and id <> '8' and id <> '' and flag is null Group by id ORDER by rank DESC
1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank FROM eikaiwa_school LEFT JOIN eikaiwa_ad ON eikaiwa_school.id=eikaiwa_ad.sc' at line 1