Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CountDistinct in SQL Server
Message
 
 
To
01/04/2008 11:33:10
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01307343
Message ID:
01307366
Views:
7
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform