MySQL 3.23 UNION失败,错误1064 [英] MySQL 3.23 UNION fails with Error 1064
问题描述
我试图在运行MySQL 3.23的旧BugZilla MySQL数据库中使用UNION语句.这是我正在尝试做的简化版本.确实没有什么异国情调,但MySQL一直在说某些地方出了问题.
I am trying to use a UNION statement in an old BugZilla MySQL DB running MySQL 3.23. Here is a simplified version of what I am trying to do. It's really nothing exotic but MySQL keeps saying that something is wrong.
(select bug_id,rep_platform from bugs where rep_platform='XX')
UNION
(select bug_id,rep_platform from bugs where rep_platform='YY');
我得到的结果是:
ERROR 1064 (HY000): You have an error in your SQL syntax near '(select bug_id,rep_platform from bugs where rep_platform='XX')
UNION
(select bu' at line 1
这实际上与您可以得到的联合声明一样简单.有什么想法吗?
This is really about as simple of a union statement as you can get. Any ideas?
我在MySQL 5 DB上运行了一个非常类似的查询,它工作得很好.这些不是MySQL 3上没有在文档或Google搜索中显示的特殊UNION语法吗?
I ran a very similar query on a MySQL 5 DB and it worked just fine. Is these some special UNION syntax on MySQL 3 that doesn't show up in documentation or Google searches?
推荐答案
UNION无法在MySQL 3中运行的原因是因为MySQL 3不支持UNION语句:)看一下官方
The reason why the UNION is not working in MySQL 3 is because MySQL 3 does not support UNION statements :) Take a look at the official documentation.
UNION用于将来自多个SELECT语句的结果合并为一个结果集.从MySQL 4.0.0起可以使用UNION.
UNION is used to combine the result from multiple SELECT statements into a single result set. UNION is available from MySQL 4.0.0 on.
看看这个文章中找到解决方法.
Take a look at this article for workarounds.
这篇关于MySQL 3.23 UNION失败,错误1064的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!