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 'AND pr1.left_key < AND pr1.level < '3' AND pr2.left_key <= pr1.left_key AND pr2' at line 1