Results 1 to 4 of 4

Thread: Query help

  1. #1
    Join Date
    Apr 2004
    Posts
    173

    Unanswered: Query help

    I'm working on a MPG query from a table that holds fuel expense information. My problem is this, I've worked out a whopper of a query that works great. But it comes up with results for each row. Ususally not a problem just use DISTINCT, but when I make it distinct it takes forever. Any thoughts appreciated.

  2. #2
    Join Date
    Jun 2002
    Location
    Saudi Arabia / Philippines
    Posts
    126
    Can you perhaps split your query into two stages: the first to sum your expense records via a GROUP BY query and the second query, based on the first, to do your arithmetic and manipulation. There again I have no idea whether this would speed things up.
    Rod

    fe_rod@hotmail.com

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Quote Originally Posted by Rod
    Can you perhaps split your query into two stages: the first to sum your expense records via a GROUP BY query and the second query, based on the first, to do your arithmetic and manipulation. There again I have no idea whether this would speed things up.
    I would think it should speed it up. If you're doing massive calculations, it's better to trim down your dataset BEFORE doing the calc's. In this way you are only doing the actual processing on the records you want to see, as opposed to calculating the entire original source, and then dropping what you don't want. Just my 2 cents.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Sep 2001
    Posts
    2
    If you are using DISTINCT so that you only get one copy of the many duplicate copies of the same data (1 copy for each row), and your query returns quickly otherwise, there is another solution you can use instead of DISTINCT. Just choose the "TOP 1" row. Take one row and let the rest disappear. Not an ideal solution, but better than the inefficiency of comparing each row to see that they are all identical!

Posting Permissions

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