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 'or team_id2=) and confirm=1 and bdate<'2024-03-19' order by bdate desc limit 0,' at line 1select bdate from tb_score where (team_id1= or team_id2=) and confirm=1 and bdate<'2024-03-19' order by bdate desc limit 0,1