Re: select null ?
Posted in 1997
In article <5psv6h$c3u$1@news01.btx.dtag.de>,
J'rgen Weber <weberj@schwend.de> wrote:
>I tried with informix workgroup server:
>
>SELECT Spalte1, Spalte2, NULL, ..., NULL
> FROM Table1
> UNION ALL
> SELECT NULL, NULL, Spalte3, Spalte4, ..., NULL
> FROM Table2>
>This is not possible.
If you wanted to run this query:-
select country_name, NULL
from country
union
select NULL, state_name
from state
then you could always do it like this (caution: ugly kludge ahead):-
select country.country_name, systables.tabname
from country, outer systables
where country.country_name = systables.tabname
union
select systables.tabname, state_name
from state, outer systables
where state.state_name = systables.tabname ;
(making sure that you don't have a table
with the same name as a country or state!)
which returns:-
country_name tabname
ALABAMA
ALASKA
ALBERTA
[....]
WISCONSIN
WYOMING
YUKON
ALBANIA
ALGERIA
ANGOLA
[....]
ZAIRE
ZAMBIA
ZIMBABWE
which I guess is what you want?
I'm not quite sure *why* you might want to mundge together data in this
way, but then the world is full of people doing things that I'm not quite
sure why anyone would want to do.
- Paul (his opinions only, not a spokesman, etc, etc)