Subject | UNION Problems |
---|---|
Author | zapperon |
Post date | 2005-01-17T13:56:58Z |
I am having problems using the union operator on two tables. Could
somebody point out my mistake. Below is the SQL code.
SELECT CAST LrgAddrData
FROM LargeAddress
WHERE WPVBSQ < 20
UNION ALL
SELECT CAST (SmllAddrData AS CHAR)
FROM SmallAddress
WHERE WPVBSQ < 20
Flamerobin shows the following error code :
*** IBPP::Exception inside Statement::Prepare ***
IBPP said : isc_dsql_prepare failed.
SQL Message : -104
Invalid token
Engine Code : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -104
Invalid command
Data type unknown
The tables look as follows :
Table : SmallAddress
SMLLADDRIDSQ INTEGER Not Null
WPVBSQ INTEGER Not Null
SMLLADDRDATA INTEGER Not Null
SMLLADDRTYP SMALLINT Not Null DEFAULT 1
Table : LargeAddress
LRGADDRIDSQ INTEGER Not Null
WPVBSQ INTEGER Not Null
LRGADDRDATA VARCHAR(100) Not Null
LRGADDRTYP SMALLINT Not Null DEFAULT 1
somebody point out my mistake. Below is the SQL code.
SELECT CAST LrgAddrData
FROM LargeAddress
WHERE WPVBSQ < 20
UNION ALL
SELECT CAST (SmllAddrData AS CHAR)
FROM SmallAddress
WHERE WPVBSQ < 20
Flamerobin shows the following error code :
*** IBPP::Exception inside Statement::Prepare ***
IBPP said : isc_dsql_prepare failed.
SQL Message : -104
Invalid token
Engine Code : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -104
Invalid command
Data type unknown
The tables look as follows :
Table : SmallAddress
SMLLADDRIDSQ INTEGER Not Null
WPVBSQ INTEGER Not Null
SMLLADDRDATA INTEGER Not Null
SMLLADDRTYP SMALLINT Not Null DEFAULT 1
Table : LargeAddress
LRGADDRIDSQ INTEGER Not Null
WPVBSQ INTEGER Not Null
LRGADDRDATA VARCHAR(100) Not Null
LRGADDRTYP SMALLINT Not Null DEFAULT 1