Running same query acrosss multiple tables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fong.yang@martecgroup.com

    #1

    Running same query acrosss multiple tables

    I've got a database with about 300,000 records. There are several
    different tables that are set up the same way with identical fields. I
    have the same queries individually set up for each table. Is there a
    way to just set the query once and then run it across several tables or
    tell the query which table to run it on. Some of the queries are just
    select queries, some are append, and some are update. Thanks.

  • tina

    #2
    Re: Running same query acrosss multiple tables

    well, if you run the queries as SQL strings in VBA (instead of query objects
    in the database window), you can easily loop through a collection of the
    table names, using each one in a given SQL string, in turn. i have to ask,
    though: why do you have multiple identical tables? that suggests that you
    are using table names to store data (a month? a "type" of something?) in
    separate groups. suggest you consider normalizing your data by putting it
    all in one table, with a field to designate which "group" each record
    belongs to. if you're not familiar with normalization principles, i strongly
    recommend you read up on the subject before proceeding further. see
    http://home.att.net/~california.db/tips.html#aTip1 for more information.

    hth


    <fong.yang@mart ecgroup.com> wrote in message
    news:1145623226 .938863.274650@ z34g2000cwc.goo glegroups.com.. .[color=blue]
    > I've got a database with about 300,000 records. There are several
    > different tables that are set up the same way with identical fields. I
    > have the same queries individually set up for each table. Is there a
    > way to just set the query once and then run it across several tables or
    > tell the query which table to run it on. Some of the queries are just
    > select queries, some are append, and some are update. Thanks.
    >[/color]


    Comment

    Working...