Subject | Re: [firebird-support] UNION question |
---|---|
Author | Ian Barwick |
Post date | 2003-08-31T13:52:19Z |
On Sunday 31 August 2003 15:33, Helen Borrie wrote:
FWIW I'm not a Firebird user, I just came across an oddity in
MySQL's implementation of UNION and was wondering
if it was a MySQL thing or something generally common in
databases. (I am pleased to say it is a MySQL thing).
Many thanks for the quick reply.
Ian Barwick
barwick@...
> At 01:27 PM 31/08/2003 +0200, you wrote:Ah, now I see, I was trying things like cast('abc' as varchar).
> >(using FB 1.5 rc4) is this kind of statement possible:
> >
> >SELECT 'abc' AS c1 FROM RDB$DATABASE
> > UNION ALL
> >SELECT c1 FROM some_table
> >
> >where some_table.c1 is a varchar / char column? I
> >get SQLCODE -104 errors but can't find any
> >method of casting the 'abc' which will work with the
> >union statement.
>
> You need to cast the "wild" column to match the type of the unioned column:
>
> select cast('abc' as varchar(40)) from rdb$database
> union all
> select surname from responder
FWIW I'm not a Firebird user, I just came across an oddity in
MySQL's implementation of UNION and was wondering
if it was a MySQL thing or something generally common in
databases. (I am pleased to say it is a MySQL thing).
Many thanks for the quick reply.
Ian Barwick
barwick@...