[ale] Selecting from multiple tables
Mike Millson
mmillson at meritonlinesystems.com
Mon Oct 3 10:03:51 EDT 2005
Union the tables together, then do a select on your union results.
e.g.
select column from (select * from table1 union select * from table2
union select * from table3).
Mike
On Sun, 2005-10-02 at 21:05, Christopher Fowler wrote:
> I have a need to do a mass select on multiple tables. The problem is
> that the tables are the same. The do not contain the same data but have
> the same schema and used for the same purpose.
>
> We have this system in our application where we divide mulitple
> Organiations into their own separate databases. Each database has the
> same schema but the data is different. I need the ability to see all
> the alarms in the alarm table fro all organizations. Normally I would
> simply use 'use AC_DEMO; select * from alarm;' In this case I need to
> do something like 'select * from AC_DEMO.alarm, AC_WIP.alarm;' The
> reason I want to do it in the select and not in the application is
> because we heavily use SQLs ability to sort and order the data. So to
> see all the alarms raised in order by date I would simply append 'order
> by raised'.
>
> This is not a simple join where you join tables by keys. This is where
> I want to select all the data from many tables that are the same. Is
> this possible?
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list