MySQL:FROM子句中的子查询

MySQL:FROM子句中的子查询,mysql,Mysql,我有这个疑问 Select cat.Title,cat.CategoryId,count(*) as Count from Companies, (Select MallCategories.CategoryId, MallCategories.Title from MallCategories JOIN Malls ON MallCategories.MallId = Malls.MallId WHERE Malls.MallId='54

我有这个疑问

Select cat.Title,cat.CategoryId,count(*) as Count 
from Companies,
     (Select MallCategories.CategoryId, MallCategories.Title 
      from MallCategories  
      JOIN Malls ON MallCategories.MallId = Malls.MallId 
      WHERE Malls.MallId='5410708140ab88a90f7b23c7') AS cat 
WHERE Companies.MallCategory=cat.CategoryId
GROUP BY cat.CategoryId
这个查询在
sqlite
数据库上运行良好,但是当我在
mysql
上使用它时,它返回这个错误

Static analysis:

2 errors were found during analysis.

An expression was expected. (near "(" at position 67)
Unexpected token. (near "(" at position 67)
SQL query: Documentation

Select cat.Title,cat.CategoryId,count(*) as Count from Companies, ( LIMIT 0, 25

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 0, 25' at line 2
我哪里做错了?你能帮我吗?谢谢


附言:这就是我所做的,而且现在起作用了, 我把它换成了这种形式

Select cat.Title,cat.CategoryId,count(*) as Count 
  from 
  (Select MallCategories.CategoryId, MallCategories.Title 
  from MallCategories JOIN Malls ON MallCategories.MallId = Malls.MallId       
  WHERE  Malls.MallId='5410708140ab88a90f7b23c7') AS cat, 
  Companies 
WHERE Companies.MallCategory=cat.CategoryId 
GROUP BY cat.CategoryId

它起作用了,我不知道这里发生了什么

附加括号。我认为
中的
选择
from
中不起作用mysql@rbr94确实,它必须工作..基于此文档,您是否尝试在phpmyadmin中执行此查询?因为在我看来,phpmyadmin正在向查询中注入它自己常用的
limit
子句——只是在错误的位置。尝试从其他MySQL客户端执行查询。不,这不会对语法产生任何影响。我认为您遇到了一个phpmyadmin错误,然后在php代码中出现了一些其他格式问题。