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 ') or (b.idpadreN2 = ) or (b.id = )) and (a.id < 12971) and a.estado = 0 and a...' at line 1