Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select Statement help

Author  Topic 

elisam75
Starting Member

2 Posts

Posted - 2012-12-21 : 12:12:49
This may sound basic, but I am new to these statement.

My simple statement has duplicate rows. Lets say 100 rows per contact with the same information. How do I make the statement just pull on row per contact? Not sure if I should use DISTINCT OR JOINS?

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-12-21 : 12:41:52
You can use DISTINCT as in
SELECT DISTINCT
col1,col2,col3
FROM
YourTable
The thing to keep in mind though, is that distinctness is determined by all the columns in the select list. If even one column has different values, then the two rows are considered distinct and so you will get two rows in the output.

There are other ways to do distinct - see Madhivanan's blog
Go to Top of Page

elisam75
Starting Member

2 Posts

Posted - 2012-12-21 : 12:45:36
Thank you I will give it a try. I think I became a bit impatient and didn't wait log enough. I have thousands of records to go through.
Go to Top of Page
   

- Advertisement -