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
 Distinct for Several columns

Author  Topic 

anbari
Starting Member

2 Posts

Posted - 2012-01-27 : 13:21:20
In the distinct for several columns whether there is the possibility of data loss?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-27 : 13:33:49
what does that mean?
it gives you distinct combinations of values in those fields

you wont lose anything from the table but it just retrieves distinct from those which are present

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-27 : 13:36:39
You MIGHT want to post some code

my guess is that you want a particular row (say on the mas add date) and the details for that row...

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

anbari
Starting Member

2 Posts

Posted - 2012-01-28 : 12:49:07
quote:
Originally posted by visakh16

what does that mean?
it gives you distinct combinations of values in those fields

you wont lose anything from the table but it just retrieves distinct from those which are present

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

If you have several fields and a field duplicate values ??will not show.
On the field Put distinct and There is the potential loss of other fields.
As well as the relationship between tables
Usually occurs in the data cleansing.
for Example:


SELECT
distinct[PDC_ProducerName]
,[PDC_BL_CNYTP],[PDC_ID]
,[PDC_Code]

FROM [Root1].[dbo].[TB_Producer]
where [PDC_ProducerName]='chammed'

PDC_ProducerName PDC_BL_CNYTP PDC_ID PDC_Code
chammed 209 9592 NULL
chammed 209 9599 NULL
chammed 175 9600 NULL
chammed 208 9661 NULL


I want to do the same Duplicate name "
PDC_ProducerName"
in the previous database with different codes stored in the same On the other hand off the names of the loss of other codes that may be associated with another table"PDC_BL_CNYTP"

Thanks for your help


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-28 : 17:50:11
sorry didnt understand which other table you're talking about. You've not posted so we cant see what it contains and what you're trying to get out of it

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -