how to retrieve only duplicate values in a table

Answer Posted / kirankumar.vangeti

For the same example given in the answer 1

select studentname, subject, count(studentname) as count
from student
group by studentname, subject
having (count(studentname)>1);

above query will give the results like

STUD1 A 2

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does cross join work?

663


How to add new employee details in an employee_details table with the following details

831


What are the various restrictions imposed on view in terms of dml?

706


What is sql keyword?

759


How do I write a cron which will run a sql query and mail the results to agroup?

725


Explain clause in sql?

758


What are sql indexes?

746


Is sql microsoft?

721


How do you know if a relationship is 2nf?

697


What is difference between group by and partition by?

698


What are the different type of joins in sql?

728


What are schema-level triggers?

771


What does an inner join do?

799


Which type of cursor is used to execute the dml statement?

720


what is 'mysqladmin' in mysql? : Sql dba

757