SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select Statement help
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

elisam75
Starting Member

USA
2 Posts

Posted - 12/21/2012 :  12:12:49  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 12/21/2012 :  12:41:52  Show Profile  Reply with Quote
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

USA
2 Posts

Posted - 12/21/2012 :  12:45:36  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000