作者yachine (无聊的男人)
看板Database
标题Re: [SQL]SQL语法请教=>使用My SQL
时间Fri Oct 19 14:50:21 2007
※ 引述《yld (努力中!!)》之铭言:
: 不好意思请教一下
: 我是My SQL的新手,这问题已经困扰我很久了
: select temp.week_ending,temp.total_sold
: from
: (select week_ending,sum(units_sold) as total_sold
: from sold
: group by week_ending) as temp
: where temp.total_sold =
: (select max(total_sold)
: from
: (select week_ending,sum(units_sold) as total_sold
: from sold
: group by week_ending) as temp2
: )
: 以上的语法我用於ACCESS与SQL Server中皆可以RUN
: 但是用在MY SQL中就不能RUN了会出现下列字句
: 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
: 'select week_ending,sum(units_sold) as total_sold from
: 想请问一下是版本问题还是My SQL不支援此种查询呢
: 谢谢!!
我记得旧版MySQL不支援副查询的方法
也就是说在Select里面的来源不可以是从另一个select而来
而在MSSQL里面这样是允许的
但是从4.1版後已经可以正确的支援
下面位址让你参考一下
http://dev.mysql.com/doc/refman/5.0/en/subqueries.html
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.115.155.168