Subject | Re: [firebird-support] Temporary tables |
---|---|
Author | Adomas Urbanavicius |
Post date | 2004-12-17T17:23:27Z |
Why not
View or query
select * from foo
left join bar on
foo.id = bar.id
where foo.name = 'Baz'
or foo.status = 1
/*
or any other :
bar.status = 1
bar.name = 'Blah'
*/
View or query
select * from foo
left join bar on
foo.id = bar.id
where foo.name = 'Baz'
or foo.status = 1
/*
or any other :
bar.status = 1
bar.name = 'Blah'
*/
>
>I have several tables that I want to query as if their rows were in a
>single table. My thinking was to use a temporary table and execute
>multiple 'select into' queries to populate it and then run a final
>select against it.
>
>E.g., given two tables:
>
> foo ( id integer, name varchar)
> bar ( id integer, name varchar, status integer)
>
>I want a structure looks like:
>
> some_structure (
> name varchar,
> status integer,
> foo_name varchar,
> bar_name varchar,
> bar_status integer)
>
>so I can run queries like:
>
> select id from some_structure where name = 'Baz' or status = 1;
> select id from some_structure where foo_name = 'Baz' or bar_status =
>1;
>
>Rows from table foo would NULL values for status. The underlying
>applications lets users select objects (represented by id) by specifying
>property name values. We validate input to ensure that an unqualified
>properties (e.g. 'name', as opposed to 'bar_name') have compatible
>types.
>
>
>
>
>