Query are >> select ID from fr_resource_product where Type='2' and Ordering > limit 1was fail because 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 'limit 1' at line 1