Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jan 2004
    Posts
    196
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Consolidating queries (2003)

    I have several instances where i have created queries to make queries. I am wondering if i can consolidate the following to 1 query?

    Query1
    SELECT tblPavSub.Equip
    FROM tblPavMain INNER JOIN tblPavSub ON tblPavMain.ID = tblPavSub.ID
    WHERE (((tblPavMain.Date)=[what day?]))
    GROUP BY tblPavSub.Equip;

    Query2
    SELECT tblEquipRates.EquipNumber, tblEquipRates.Description
    FROM tblEquipRates
    WHERE (((tblEquipRates.Division)="1"))
    GROUP BY tblEquipRates.EquipNumber, tblEquipRates.Description;

    Query3
    SELECT Query2.EquipNumber, Query2.Description
    FROM Query1 RIGHT JOIN Query2 ON Query1.Equip = Query2.EquipNumber
    WHERE (((Query1.Equip) Is Null));

    thanks,
    jackal

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Consolidating queries (2003)

    There's little to be gained, if it is possible at all. The design of a consolidated query would probably be convoluted, and it wouldn't be more efficient to boot, because the Jet Engine optimizes queries, including queries built on queries.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2004
    Posts
    196
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Consolidating queries (2003)

    As long as I am only accessing my data via MSAccess, this is not such a problem. But when I create ASPs, it is not possible to query a query, that I am aware of...

    thanks for the info.

    jackal

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Consolidating queries (2003)

    From the SQL it doesn't seem easy to combine the queries, but I'd have to see the database to be sure...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •