• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

How can I remove duplicates from list box

Hi experts,

I have the following SQL statement:

SELECT DISTINCT XKIncidentTasks.IncidentTaskID, XKIncidentTasks.Sequence, XKIncidentTasks.IncidentTask, XKIncidentTasks.IncidentTaskDuration
FROM XKIncidentTasks
ORDER BY XKIncidentTasks.Sequence;


My table XKIncidentTasks contains 59 records. All have an autonumber which is "IncidentTaskID".  Around 15 of these records all contain the same text in the field "IncidentTask".  I would like to remove these 15 records from my list box.  I do not want to delete them from the table.

I have tried using the DISTINCT coding in my SQL but this does not work because Access does not see any duplicate records due to the "IncidentTaskID" field.  I need the "IncidentTaskID" to be present in my list box.

Can anybody help me?

Thank you.
Terry
0
TerenceHewett
Asked:
TerenceHewett
1 Solution
 
Monky42Commented:
add GROUP BY XKIncidentTasks.IncidentTask
Then DISTINCT will make sure only mutually different IncidentTasks are shown.
0
 
TerenceHewettAuthor Commented:
Thank you very much for your help.  This worked a treat.  All I needed to do was Group the IncidentTask and "Sum" the rest of my fields in the query.

Best regards
Terry
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now