David Jeffery David Jeffery - 1 month ago 5
SQL Question

How do I select distinct and count those selected?

How do I select distinct and count those selected? This is my code for the Select Distinct:

SELECT distinct [ClientID]
,[AssessmentDate]

FROM [dbo].[UserAssessrcads]


I would like it to end with:

RCADS 62


(or something like that)

Answer

You can use a temp table

  select count(*) from ( 
      SELECT distinct  [ClientID]
              ,[AssessmentDate]
        FROM [dbo].[UserAssessrcads] ) t
Comments