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

Do you know what are the differences between lost updates and uncommitted dependencies?

0 Answers  


What is a view?

6 Answers  


Can we take the full database backup in log shipping?

0 Answers  


Can we update data in a view?

0 Answers  


What are the benefits of normalization?

0 Answers  






Once setting replication, is it potential to own a publisher as sixty four bit sql server and distributor or subscribers as a thirty two bit sql server?

0 Answers  


What is the usage of the sign function?

0 Answers  


How do you connect 100 files as a flat file sources in one package of SSIS?

2 Answers  


How to set the current database in ms sql server?

0 Answers  


what information is maintained within the msdb database? : Sql server administration

0 Answers  


what is a schema in sql server 2005? : Sql server database administration

0 Answers  


How to create and drop temp table in sql server?

0 Answers  


Categories