0

I would like to check if several tables are locked or not. I tried to do it this way:

SHOW OPEN TABLES WHERE (Table LIKE 'table_name' OR Table LIKE 'table2_name') AND In_use > 0

But i'm getting error

#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

I checked that this one works fine:

SHOW OPEN TABLES WHERE In_use > 0 LIKE "table_name"

but i need to check it for several tables and i would like to do it just using one query. I use MySQL in version 5.5.24

4

1 回答 1

0

Table 是保留字,尝试在“Table”周围添加反引号,如下所示:

SHOW OPEN TABLES WHERE (`Table` LIKE 'table_name' OR `Table` LIKE 'table2_name') 
AND In_use > 0
于 2012-08-10T13:15:43.017 回答