MonetDB中

时间:2015-08-20 11:20:30

标签: sql monetdb

如何在MonetDB中编写以下查询:

CREATE TABLE "sampled" AS (
 SELECT *
 FROM   "base"
 WHERE  "target" = 'B'
 LIMIT  30
) UNION ALL (
 SELECT * 
 FROM "base" 
 WHERE "target" = 'A' 
 LIMIT 30 
) WITH DATA

当我尝试在以下位置执行上述查询时:

  

MonetDB数据库服务器工具包v1.1(Oct2014-SP2)

     

OS X 10.9.5

我得到了:

Error: syntax error, unexpected LIMIT, expecting INTERSECT or EXCEPT or UNION or ')' in: "create table "sampled" as (
SQLState:  42000
ErrorCode: 0 
Error:      select * 
SQLState:  22000 
ErrorCode: 0 
Error: from   "predictor_factory"."base"" 
SQLState:  22000 
ErrorCode: 0

仅凭联盟就可以正常运作:

SELECT *
FROM   "base"
WHERE  "target" = 'B'
UNION ALL
SELECT * 
FROM   "base"
WHERE  "target" = 'A'

单独限制也很有效:

SELECT * 
FROM   "base"
WHERE  "target" = 'A'
LIMIT  30

这对我来说很麻烦。

0 个答案:

没有答案