Results 1 to 4 of 4
  1. #1
    RobRay is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    11

    Query returns duplicates

    Hi guys, I have a database with about 20 or so different tables which are all linked through LocationID to tblLocation. I need to make reports for each Location ID (about 150), which lists any info present in each of the 20 tables. I'm sure there's a simple way to do this, but I'm fairly novice with Access.

    I've tried different joins as well as just making a report from queries which show individual assets but that produces an error.

    I've been trying this query all sorts of ways with DISTINCT row and DISTICNT ID but nothing seems to work

    Here's the SQL:
    SELECT DISTINCTROW tblLocation.LocationName, tblBleachers.BleacherID, tblBleachers.Cost, tblPlayground.PlaygroundID, tblPlayground.PlaygroundCost
    FROM (tblLocation INNER JOIN tblBleachers ON tblLocation.LocationID=tblBleachers.LocationID) INNER JOIN tblPlayground ON (tblLocation.LocationID=tblPlayground.LocationID) AND (tblBleachers.LocationID=tblPlayground.LocationID)
    WHERE (((tblLocation.LocationName)="Hampton"));

    The output looks like this:


    Location BleacherID PlaygroundID
    Hampton 10 15
    Hampton 11 15

    Because there are 2 different bleachers and only 1 playground, it just repeats the playground to fill space, but I'm not sure how to stop this from happenning.

    Please help me solve this, I've been trying for so long now and nothing seems to work.

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    remove the bleacherID from the select list, and change distinctrow to distinct.

  3. #3
    RobRay is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    11
    That didn't fix the duplication issue, just removed bleacherID.
    Thanks for assistance though.

    I think it would be fine if there actually were 2 playgrounds, then it wouldn't have to repeat, is there a way to have access not repeat the same record for Playgrounds?

  4. #4
    RobRay is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    11

    Thumbs up Subreports

    I think I found a way to solve this using subreports.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Avoiding duplicates in query
    By theracer06 in forum Queries
    Replies: 1
    Last Post: 08-24-2010, 12:49 PM
  2. Replies: 2
    Last Post: 08-05-2010, 09:29 AM
  3. Duplicates in Query
    By Dega in forum Queries
    Replies: 1
    Last Post: 05-02-2010, 05:09 PM
  4. Aggregate Query Returns No Values
    By Xiaoding in forum Queries
    Replies: 6
    Last Post: 03-29-2010, 02:01 PM
  5. Query returns null..based on two tables
    By shsh_shah in forum Queries
    Replies: 1
    Last Post: 03-08-2009, 01:45 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums