While using ORDER BY Field function of MySQL, the following error occurred:
FUNCTION database_name.FIELD does not exist
Here’s a quick solution
FUNCTION FIELD does not exist
If you are using a query like below:
SELECT * FROM tbl ORDER BY FIELD (id,1,2,3);
then there’s a chance you may face this type of error while running the query.
Solution is simple. Remove the space between FIELD and round bracket (.
So the query should look like:
SELECT * FROM tbl ORDER BY FIELD(id,1,2,3);
and your problem could have resolved.
Hope this works.