Reputation: 32
I can run this sql succesfully:
select count(distinct(BusinessEntityID)) from Person.Person
But what if I want to know this, give me error:
select count(distinct(*)) from Person.Person
How can I run equliviant sql ?
Upvotes: 0
Views: 118
Reputation: 483
please use directly count(*)
for example :
select count(*) from Person.Person
Upvotes: -1
Reputation: 26846
You can use query like this to get count of distinct records in table:
select count(*) from (select distinct * from Person.Person) as T
In the inner select you're retrieving distinct records, and in the outer one you're getting the count.
Upvotes: 4