Deleting duplicate values in a DataSet

G

Guest

Hi folks,

I have a DataSet that returns values from a single column in a database
where I query a table named USERS for companies that are working on a given
project.

The SQL statement is as follows:

SELECT COMPANYNAMES FROM USERS WHERE PROJECT = @PROJECT

In many cases I have users who are from the same company working on the same
project. I have considered my database design but I don't see that it needs
changes or how to query it to not receive duplicate values.

For example values such as MICROSOFT, ORACLE, MICROSOFT would need to have
duplicate values to be MICROSOFT, ORACLE.

I have checked the DataSet methods but none exist to handle this.
Thanks for any thoughts.
glenn
 
G

Guest

Glenn,

You could get distinct values from the database:

SELECT DISTINCT COMPANYNAMES FROM USERS WHERE PROJECT = @PROJECT

Kerry Moorman
 
G

Guest

Kerry,

Thanks so much for your help. SELECT DISTINCT solved my problem.

I looked through my SQL statement reference and there it was - DISTINCT.

Just haven't had the need to use it - until now.

Thanks again,
Glenn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top