Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CountDistinct in SQL Server
Message
 
 
À
01/04/2008 11:33:10
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01307343
Message ID:
01307366
Vues:
6
>>You need to remove Program from the Group BY clause. However, now we have a problem of including Program in the result. Need to think a second.
>>
>>select my.Person, my.Program, sql.ProgramCount from myTable inner join (
>>SELECT     PersonID, COUNT(DISTINCT Program) AS ProgramCount
>>FROM         dbo.tmmLicesnses2Persons
>>WHERE     (DateActivated IS NOT NULL) AND (DateDeactivated IS NULL)
>>GROUP BY PersonID) sql on my.Person = sql.Person where
>>(my.DateActivated IS NOT NULL) AND (my.DateDeactivated IS NULL) group by 1,2,3
>>
>
>Thus my problem. BTW, thank you for your help. :)

Did you see my reply updated?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform