Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sql Server Distinct

Posted on 2011-03-14
3
Medium Priority
?
284 Views
Last Modified: 2012-05-11
Hi,

Can you please explain how distinct will work  if we have a query like this..

select distinct ColA,ColB,ColC from EmpTable.

0
Comment
Question by:N_Sri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 41

Accepted Solution

by:
Sharath earned 1200 total points
ID: 35133956
It will give you a distinct record for the combination of ColA,ColB and ColC. So if you have multiple records for this combination, you will get only one record.

For example, assume you have records like this
ColA      ColB      ColC
A      B      C
A      B      C
A      B      D
B      C      D
S      C      D

with DISTINCT, you get one combination for these three columns.
ColA      ColB      ColC
A      B      C
A      B      D
B      C      D
S      C      D

Does that make sense?
0
 
LVL 32

Assisted Solution

by:Ephraim Wangoya
Ephraim Wangoya earned 800 total points
ID: 35133971

It means for each row selected, the combination of the fields ColA, ColB and ColC will always be unique on each row

eg
0,0,1
0,1,0
0,1,1
1,0,0
1,0,1
1,1,0
1,1,1
0
 

Author Closing Comment

by:N_Sri
ID: 35134075
thankyou
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 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