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

What are the steps to follow to configure SQL*Net?

0 Answers   Tech Mahindra,


What are the type of joins? When do we use Outer and Self joins?

3 Answers  


What is the use of nvl work?

0 Answers  


Explain what is scheduled job and how to create it?

0 Answers  


Explain the third normal form(3nf)?

0 Answers  






Which command executes the contents of a specified file?

2 Answers   ABC, InfoMedia,


When columns are added to existing tables, what do they initially contain?

0 Answers  


What are the disadvantages of indexes?

0 Answers  


How to create a simple user defined function in ms sql server?

0 Answers  


Explain about sql server login?

0 Answers  


Can we join two tables without primary key?

0 Answers  


i need to know how i display department which has salary > =5000 for the below table Department ----------- salary deptname 1000 a 3000 a 2000 b 3000 b 4000 c 5000 c kindly send the query to thilakvinoth13@gmail.com

6 Answers  


Categories