Subject Re: Using unions
Author rajsubramani
--- In firebird-support@yahoogroups.com, Aage Johansen <aagjohan@o...>
wrote:
> On Tue, 3 Feb 2004 20:19:46 +0000 (UTC), rajsubramani wrote:
>
> > I'm using firebird 1.0.
> >
> > When I try to do
> >
> > select book_id, price, '' as condition
> > from Book
> > UNION
> > select bk.book_id, price, condition
> > from Stock sk, Book bk where
> > bk.book_id = sk.book_id
> >
> > I keep getting
> > SQL error code = -104
> > Invalid command
> > Data type unknown
> >
>
>
>
> The type of the empty string ('') is different from "condition".
>
> 1. Cast the '' to the type of "condition"
> 2. Use aliases always when doing joins
> 3. Use explicit joins (don't do it in the WHERE clause)

Thanks for the reply, Aage. However, pardon my ignorance, I don not
know how to transalate your suggestions to sql.

1. Since condition is Blob sub type 1, how will the type cast look
like in the sql statement.

2. Will the UNION not work if aliases are not used in the joins?

3. Again I do not understand this, some sql example will be useful.

Your help id much appreciated.

Cheers
-raj