Solved

How can I remove duplicates from list box

Posted on 2008-10-14
2
287 Views
Last Modified: 2012-05-05
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
Comment
Question by:TerenceHewett
2 Comments
 
LVL 2

Accepted Solution

by:
Monky42 earned 500 total points
ID: 22710126
add GROUP BY XKIncidentTasks.IncidentTask
Then DISTINCT will make sure only mutually different IncidentTasks are shown.
0
 

Author Comment

by:TerenceHewett
ID: 22710155
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question