ERROR 1176 (42000): Key 'XXX' doesn't exist in table 'XXX'报错处理

Posted godfather007

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ERROR 1176 (42000): Key 'XXX' doesn't exist in table 'XXX'报错处理相关的知识,希望对你有一定的参考价值。

mysql5.7对sql语句强制使用索引查询时报错如下:

技术图片

解决:这里的id字段是表的主键,查看别人的经验贴得知是语法错误,参考链接https://stackoverflow.com/questions/19205004/key-emp-no-doesnt-exist-in-table-employees ,当强制索引是主键时sql语句应这样写

mysql> SELECT COUNT(UA.id) AS tp_count FROM  ck_user_audit UA RIGHT JOIN ck_user AS U force index(PRIMARY) ON U.id = UA.uid LIMIT 1;

 

以上是关于ERROR 1176 (42000): Key 'XXX' doesn't exist in table 'XXX'报错处理的主要内容,如果未能解决你的问题,请参考以下文章

ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length

php artisan migrate时出现 SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was to

Mysql ERROR 1064 (42000)