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 is the disadvantage of SQL Loder?

1 Answers   TCS,


How to get a list of table columns using the "sp_columns" stored procedure in ms sql server?

0 Answers  


what's the difference between SQL & MY-SQl...? And what we learn from these ....?

2 Answers   Broadridge,


How do I find the size of a sql server database?

0 Answers  


Explain the various types of concurrency problem. I.e. Lost or buried updates, uncommitted dependency, inconsistent analysis, phantom read?

0 Answers  






Does sql server 2016 have ssms?

0 Answers  


What is partition index in sql server?

0 Answers  


What all db objects can be found in MSDB database of a SQL Server instance?

2 Answers   Accenture,


Write a query to include a constraint, to check whether the employee salary is greater than 5000?

0 Answers   TCS,


Do you know what is sql service broker?

0 Answers  


What is difference statement and preparedstatement?

0 Answers  


How efficient you are in oracle and SQL server?

0 Answers   CGI,


Categories