View Single Post

   
  #2 (permalink)  
Old 02-22-2008, 05:38 PM
Sybrand Bakker
 
Posts: n/a
Default Re: Accessing 2 tables with 1 name

On 1 Jul 2003 13:05:16 -0700, mperrault@ingdirect.com (Mark Perrault)
wrote:

>I have 2 IDENTICAL tables (TableName_A and TableName_B) that I use in
>my production system. I have a table (TableState) with 1 row and 1
>column whose value determines which table is the "active set". (ie,
>TableState had a column named TableSet whose value is either 'A' or
>'B').
>
>I would like to setup a view that can allow me to write queries with
>"from Tablename" where the selection of A or B is done in the
>background on the fly.
>
>Is this possible?
>
>Thanks,
> Mark



yes it is possible by simply
select * from table_a
union
select * from table_b

However, it looks like you really should merge the 2 tables into one,
and setup table_a and table_b as views with check option. Likely much
more efficient.


Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address
Reply With Quote