How to get the count of distinct records. Please give me the
query?

Answers were Sorted based on User's Feedback



How to get the count of distinct records. Please give me the query?..

Answer / kanika

this will also work

select count(distinct columnname) from table

Is This Answer Correct ?    18 Yes 1 No

How to get the count of distinct records. Please give me the query?..

Answer / name

select count(distinct columnname) from table ,this is correct as i checked the query

Is This Answer Correct ?    13 Yes 1 No

How to get the count of distinct records. Please give me the query?..

Answer / anusha

SELECT COUNT(*)FROM(SELECT DISTINCT columnname FROM
tblname)

Is This Answer Correct ?    7 Yes 5 No

How to get the count of distinct records. Please give me the query?..

Answer / pradyumna

select distinct colname,count(colname) from tbl group by
colname

Is This Answer Correct ?    2 Yes 0 No

How to get the count of distinct records. Please give me the query?..

Answer / madhavi.bandreddi

select count(*) from (select distinct * from tablename)as
dummytable

Is This Answer Correct ?    3 Yes 2 No

How to get the count of distinct records. Please give me the query?..

Answer / gouri

SELECT count(*) FROM
(SELECT distinct ngcode FROM donation )d

Is This Answer Correct ?    4 Yes 4 No

How to get the count of distinct records. Please give me the query?..

Answer / anilreddy

select count(distinct(columnname)) from tablename

Is This Answer Correct ?    0 Yes 0 No

How to get the count of distinct records. Please give me the query?..

Answer / soumya

select distinct (columnname) from tablename

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More SQL Server Interview Questions

How many types of indexes are there in SQL Server?

6 Answers   CarrizalSoft Technologies, United Healthcare,


Describe triggers features and limitations?

0 Answers  


What happens to a trigger with multiple affected rows?

0 Answers  


Differences between Standby Vs No recovery?

2 Answers   Wipro,


How to convert numeric expression data types using the cast() function?

0 Answers  






Explain active/passive and active/active cluster configurations?

0 Answers  


How you can find out if an index is useful to the optimizer?

0 Answers  


Explain different types of lock modes in sql server 2000?

0 Answers  


SQL Server Architecture ?

0 Answers   IBM, Sapient,


how to take backup bcp out for a column in table in sql server?

0 Answers  


Anyone please explain me the concept of Serialization?

3 Answers  


Do you know spatial data types - geometry and geography in sql server 2008?

0 Answers  


Categories