On Tue, Feb 3, 2009 at 8:47 AM, Deviloper <devilo...@slived.net> wrote:

> Hello there!
>
> lets assume that one has a list of tables @db_tables. (For Example one per
> Month)
> Lets assume one wants to find some data in the tables. (For Example sold
> Items.)
>
> select sales from $db_tables[0]; # gives all sold items in January
>

You could use a UNION in the database to combine the common data (you can
create a view and use that for your select):

CREATE VIEW v_combined_months AS
SELECT 'January' AS "Month",sales FROM jan_sales
 UNION ALL
 SELECT 'February' AS "Month",sales FROM feb_sales
 UNION ALL
 SELECT 'March' AS "Month",sales FROM march_sales
[...]

-- 
pDale

Reply via email to