The table tbl_sites contains the following data:
-----------------------------------------------------
Userid sitename country
------------------------------------------------------
1 sureshbabu indian
2 PHPprogrammer andhra
3 PHP.net usa
4 PHPtalk.com germany
5 MySQL.com usa
6 sureshbabu canada
7 PHPbuddy.com pakistan
8. PHPtalk.com austria
9. PHPfreaks.com sourthafrica
10. PHPsupport.net russia
11. sureshbabu australia
12. sureshbabu nepal
13. PHPtalk.com italy
Write a select query that will displayed the duplicated
site name and how many times it is duplicated?

Answer Posted / bashi

SELECT sitename, COUNT(*) AS NumOccurrences
FROM tbl_sites
GROUP BY sitename HAVING COUNT(*) > 1

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to rename an existing column in a table?

541


How do I find the size of a mysql database?

485


Create table employee (eno int(2),ename varchar(10)) ?

547


What is unsigned in mysql?

511


How you will Show unique records.

548






How to create trigger in mysql phpmyadmin?

520


How do I rename a table in mysql workbench?

503


Does mysql case matter?

496


What is table level locking in mysql?

481


How do you determine the location of mysql data directory?

495


Write a command to list all databases in mysql?

533


How do I change mysql password?

495


What is the current version of mysql?

485


How to enable or disable a row of a table using MySQL in struts?

3574


What is a storage engine?

561