Have a database table with various tasks and each has a time against it that it should take, some tasks have the same time. I now need to display these times in a drop down list but only want to display each time once, how can I do this?


Try something like this substituting your table and field names:

select table.timefield,
count(table.timefield) AS NumberOf
NumberOf > 1

This should give you only times where there is more than on row and the number of rows.

After I posted I realised I could alter the stored proc and use DISTINCT, hopefully this works. Thank you though, if DISTINCT doesn't work I'll try your way :)

Distinct will work perfectly. I read your request as wanting only times where ther were duplicates. Also look at group by for some options.

This article has been dead for over six months. Start a new discussion instead.