Subject Re: [firebird-support] what is wrong in this select?
Author Helen Borrie
At 10:34 AM 28/02/2008, Fidel Viegas wrote:
>But, generally speaking the
>union operator should be used to draw information from two or more
>tables with the same structure.

Erm, not so. UNION is often used - perhaps even *most often* used - to draw a set from a single table. Typically this will be where you want different information from a row depending on some condition that is determined by some control value. For a union the engine doesn't care where the data comes from, as long as the second and subsequent subsets match type-for-type.

However, you are right in your observation that the example query was a pretty idiotic waste of engine effort. Trying to make a daft query work "just because it works in Oracle" seems a futile waste of bandwidth. A daft query is a daft query. The developer might achieve more by concentrating on what his application code is doing, that allows it to generate daft queries from user inputs, regardless of which back-end the queries are going to.

./heLen