MySQL Forums
Forum List  »  Optimizer & Parser

Error when using Indexing hint
Posted by: Susi P
Date: March 28, 2010 04:11AM

Hi

I got strange error when I use Index hint. I have pasted below the SQL, that I use . I don't know why I get this error .

mysql> SELECT name FROM cities USE INDEX FOR ORDER BY (ix_city_name) ORDER BY name;

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 'ORDER BY (ix_city_name) ORDER BY name' at line 1


mysql> SHOW index FROM cities;
+--------+------------+--------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+--------+------------+--------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| cities | 0 | PRIMARY | 1 | id | A | 17 | NULL | NULL | | BTREE | |
| cities | 1 | ix_city_name | 1 | name | A | 17 | NULL | NULL | YES | BTREE | |
| cities | 1 | region_idx | 1 | region_id | A | 1 | NULL | NULL | YES | BTREE | |
+--------+------------+--------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
3 rows in set (0.00 sec)



mysql> select version();
+-----------+
| version() |
+-----------+
| 5.0.77 |
+-----------+
1 row in set (0.00 sec)



Can any one help me on this?

Options: ReplyQuote


Subject
Views
Written By
Posted
Error when using Indexing hint
2974
March 28, 2010 04:11AM
1515
March 28, 2010 10:53PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.