Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Want only 2 columns distinct
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00540370
Message ID:
00540386
Vues:
20
Sergey,

Good question. I almost answered, it doesn't matter, but then why do I need the info, unless as in the case of the prices where they will always be the same and so I could include them in the distincness anyway.

I see now why distinct acts the way it does. <s>

Thanks,
Terry

>Terry,
>
>If you have different set of id,price1,price2,price3,price4,price5,cost associated with one pid,lot combination than wich one you want to see in the result?
>
>>How do I get a subset of my table where only 2 of the seven fields that I need in the result can be and must be distinct?
>>
>>select distinct pid,lot from products
>>(gives the right # of records)
>>
>>select distinct pid,lot,id,price1,price2,price3,price4,price5,cost
>>(gives too much distinction even though I need the other fields)
>>
>>Thanks :)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform