Results 1 to 4 of 4
  1. #1
    helpaccess is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    18

    Unique values

    I have two queries. One return the most recent date and test score. The other returns the next most recent date and test score. I want to make sure there is only one score per student in each query, but right now, it is showing multiple scores for some students. I have checked the Unique values property box to yes, but that isn't working. Any other ideas?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    We need sample data and/or query statements to analyse.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    helpaccess is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    18
    SELECT Max([SATS-R LOCUS].[Date Completed]) AS [SecondMaxOfDate Completed], [SATS-R LOCUS].Client, [SATS-R LOCUS].[Level Of Care] FROM [SATS-R LOCUS] INNER JOIN MaxDateLOCUS ON [SATS-R LOCUS].Client=MaxDateLOCUS.Client WHERE ((([SATS-R LOCUS].[Date Completed])<(MaxDateLOCUS.[MaxOfDate Completed])) And (([SATS-R LOCUS].Client)=MaxDateLOCUS.Client))
    GROUP BY [SATS-R LOCUS].Client, [SATS-R LOCUS].[Level Of Care] ORDER BY Max([SATS-R LOCUS].[Date Completed]) DESC;

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I think what you need to do is return the Top 1 record in each group where [Date Completed] is less than the Max([Date Completed]). This might not be an easy query to understand and build. I would need data to build and test with.

    Google: sql top 1 for each group
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Duplicate Query Reporting Unique Values...
    By Tomfernandez1 in forum Queries
    Replies: 5
    Last Post: 04-19-2011, 04:22 PM
  2. Creating a unique ID for a new set of values
    By slaterino in forum Programming
    Replies: 1
    Last Post: 08-24-2010, 09:35 AM
  3. Unique Values and Boolean Fields
    By Triad in forum Forms
    Replies: 1
    Last Post: 07-15-2010, 06:28 PM
  4. Replies: 1
    Last Post: 03-27-2010, 06:13 AM
  5. Count of Unique Values
    By vsmk in forum Queries
    Replies: 2
    Last Post: 03-14-2010, 12:07 AM

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