Possible Duplicate:
Is it possible to have function-based index in MySQL?
I have a table with a string field s and I want to run this query:
SELECT * FROM mytable WHERE s = LEFT("färgkört", CHAR_LENGTH(s));
Its explanation clearly says that I am not using the index on that field:
+----+-------------+--------------+------+---------------+------+---------+------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------------+------+---------------+------+---------+------+--------+-------------+
| 1 | SIMPLE | mytable | ALL | NULL | NULL | NULL | NULL | 766554 | Using where |
+----+-------------+--------------+------+---------------+------+---------+------+--------+-------------+
Is there any way to optimize a query like this?