Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
Other Resources:
How To Count Duplicated Values in a Column
How To Count Duplicated Values in a Column? - MySQL FAQs - SQL SELECT Query Statements with GROUP BY
✍: FYIcenter.com
If you have a column with duplicated values, and you want to know what are those duplicated values are and how many duplicates are there for each of those values, you can use the GROUP BY ... HAVING clause as shown in the following example. It returns how many duplicated first names in the fyi_team table:
mysql> SELECT first_name, COUNT(*) FROM fyi_team GROUP BY first_name HAVING COUNT(*) > 1; +------------+----------+ | first_name | COUNT(*) | +------------+----------+ | John | 6 | +------------+----------+ 1 row in set (0.01 sec)
2007-05-11, 4854👍, 0💬
Popular Posts:
If cookies are not enabled at browser end does form Authentication work? No, it does not work.
Explain all parts of a deployment diagram? Package: It logically groups element of a UML model. Node...
What Is URI? URI (Uniform Resource Identifier) is a superset of URL. URI provides a simple and exten...
Can include files be nested? The answer is yes. Include files can be nested any number of times. As ...
How To Increment Dates by 1? - Oracle DBA FAQ - Understanding SQL Basics If you have a date, and you...