Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2007
    Posts
    6

    Unanswered: Picking out duplicate records

    Hi, I have a student results table with the layout shown below (four records with the fields separated by dashes). Sorry its so messy. Anyway, you can see that there are duplicates. I want to write an SQL statement that will pick out only the 'supplemental' records if duplicates occur. Any ideas on how to do this?

    ID - StudentNo - Subject - Term - Yearofstudy - YearTaken - Grade
    1195 - 11111111 - MA1E2 - Annual - 1 - 2006 - 34
    1205 - 11111111 - MA1E2 - Supplemental - 1 - 2006 - 40 (S)
    1194 - 11111111 - MA1E1 - Annual -1 - 2006 - 35
    1204 - 11111111 - MA1E1 - Supplemental - 1 - 2006 - 40 (S)

    Here is the SQL I'm using to get all the records from the studentresults table, for first years only:

    SELECT *
    FROM studentresults
    WHERE studentresults.StudentNo = 11111111 AND studentresults.YearOfStudy = 1

    How do I change this to pick out only the supplemental exam results?

    Regards,

    sabatier

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I don't see any duplicates in the data that you've presented. I would think that you'd add a test for supplemental to the WHERE clause.

    -PatP

Posting Permissions

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