Subject | UNION syntax? |
---|---|
Author | Richard Wesley |
Post date | 2008-08-14T18:23:47Z |
Hi all -
I am trying to write a union query with FB 2.1 (using a query
generator) and the following query generates an error:
<QUERY>
SELECT FIRST 1 *
FROM (
(
SELECT "key" AS "UnionKey",
"bool0" AS "UnionBoolean",
"int0" AS "UnionInteger",
"num0" AS "UnionNumber",
"str0" AS "UnionString",
"date0" AS "UnionDate",
"datetime0" AS "UnionDateTime",
"time0" AS "UnionTime",
0 AS "UnionID"
FROM "Calcs" "Calcs 1"
)
UNION ALL
(
SELECT "key" AS "UnionKey",
"bool1" AS "UnionBoolean",
"int1" AS "UnionInteger",
"num1" AS "UnionNumber",
"str1" AS "UnionString",
"date1" AS "UnionDate",
"datetime0" AS "UnionDateTime",
"time1" AS "UnionTime",
1 AS "UnionID"
FROM "Calcs" "Calcs 2"
)
) "Union"
</QUERY>
--- FB Error
---------------------------------------------------------------
File: db\firebirdprotocol.cpp, Line: 1732
Status: 335544569
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 15, column 3
-UNION
------------------------------------------------------------------------
----
A similar query works just fine under MS-SQL. Does it not like the
parentheses? Or is it just that you can't select from a UNION?
________________________________________________________
Richard Wesley Senior Software Developer Tableau
Software
Visit: http://www.trytableau.com/now.html
I am trying to write a union query with FB 2.1 (using a query
generator) and the following query generates an error:
<QUERY>
SELECT FIRST 1 *
FROM (
(
SELECT "key" AS "UnionKey",
"bool0" AS "UnionBoolean",
"int0" AS "UnionInteger",
"num0" AS "UnionNumber",
"str0" AS "UnionString",
"date0" AS "UnionDate",
"datetime0" AS "UnionDateTime",
"time0" AS "UnionTime",
0 AS "UnionID"
FROM "Calcs" "Calcs 1"
)
UNION ALL
(
SELECT "key" AS "UnionKey",
"bool1" AS "UnionBoolean",
"int1" AS "UnionInteger",
"num1" AS "UnionNumber",
"str1" AS "UnionString",
"date1" AS "UnionDate",
"datetime0" AS "UnionDateTime",
"time1" AS "UnionTime",
1 AS "UnionID"
FROM "Calcs" "Calcs 2"
)
) "Union"
</QUERY>
--- FB Error
---------------------------------------------------------------
File: db\firebirdprotocol.cpp, Line: 1732
Status: 335544569
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 15, column 3
-UNION
------------------------------------------------------------------------
----
A similar query works just fine under MS-SQL. Does it not like the
parentheses? Or is it just that you can't select from a UNION?
________________________________________________________
Richard Wesley Senior Software Developer Tableau
Software
Visit: http://www.trytableau.com/now.html