SQL: query occurrences of multiple fields in a table

SELECT id, name , email,
COUNT(id) AS NumOccurrences
FROM student_record
GROUP BY id, name, email
HAVING ( COUNT(id) > 1 );
- student_record is table name.
- id, name, email are column names.
- counting more than one occurrences for above column.


As an Amazon Associate I earn from qualifying purchases.

No comments:

Post a Comment

Post Scriptum

The views in this article are mine and do not reflect those of my employer.
I am preparing to cancel the subscription to the e-mail newsletter that sends my articles.
Follow me on:
X.com (Twitter)
LinkedIn
Google Scholar

Popular Recent Posts

Most Popular Articles

apt quotation..