MySQL - 为什么使用'IN'查询失败?

Maj*_*our 0 mysql error-handling

这些查询返回正确的结果:

SHOW FULL COLUMNS FROM `users`
SHOW FULL COLUMNS FROM `teachers`
Run Code Online (Sandbox Code Playgroud)

但是这个会产生错误

SHOW FULL COLUMNS IN  ('users', 'teachers')
Run Code Online (Sandbox Code Playgroud)

我试过单引号,双引号,反引号,没有引用,都失败了.我究竟做错了什么?

错误是这样的:

#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 '('users', 'teachers')' at line 1
Run Code Online (Sandbox Code Playgroud)

Jas*_*ett 5

也许这会给你你想要的东西?

SELECT *
  FROM information_schema.columns
 WHERE table_name IN ('users', 'teachers')
Run Code Online (Sandbox Code Playgroud)

  • 哦,一个SQL向导已经出现了:) +1,用于将问题转移到真正重要的问题上 (2认同)