trying to drop the index if it exists
checking if the index exists- in the inner query
ALTER TABLE tableA DROP INDEX indexname WHERE (SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'tableA' AND INDEX_NAME = 'indexname' AND INDEX_SCHEMA='schemaA')=1;
ERROR 1064 (42000): 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 'WHERE (SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = tableA ' at line 1
in mysql version 5.7