我想检查几个表是否被锁定。我试着这样做:
SHOW OPEN TABLES WHERE (Table LIKE 'table_name' OR Table LIKE 'table2_name') AND In_use > 0
但我收到错误
#1064 - 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
'Table LIKE 'table_name' OR Table LIKE 'table2_name') AND In_use > 0' at line 1
我检查过这个工作正常:
SHOW OPEN TABLES WHERE In_use > 0 LIKE "table_name"
但我需要检查几个表,我想只使用一个查询。我在版本5.5.24中使用MySQL
答案 0 :(得分:0)
表是一个保留字,试图在“Table”周围添加反引号,如下所示:
SHOW OPEN TABLES WHERE (`Table` LIKE 'table_name' OR `Table` LIKE 'table2_name')
AND In_use > 0