xxxxxxxxxx
SELECT *
FROM TableA A
WHERE NOT EXISTS (SELECT *
FROM TableB B
WHERE A.NUM = B.NUM);
xxxxxxxxxx
SELECT name, COUNT(email)
FROM users
GROUP BY email
HAVING COUNT(email) > 1
xxxxxxxxxx
• SELECT first_name, COUNT (first_name) FROM employees
GROUP BY first_name
HAVING (COUNT(first_name) > 1);
xxxxxxxxxx
Multiple field=
SELECT username, email, COUNT(*)
FROM users
GROUP BY username, email
HAVING COUNT(*) > 1
Single field=
SELECT _column, COUNT(*)
FROM _table
GROUP BY _column
HAVING COUNT(*) > 1
xxxxxxxxxx
SELECT column1, column2, COUNT(*)
FROM table_name
GROUP BY column1, column2
HAVING COUNT(*) > 1;
xxxxxxxxxx
SELECT column_name, COUNT(*)
FROM table_name
GROUP BY column_name
HAVING COUNT(*) > 1;
xxxxxxxxxx
SELECT column_name, COUNT(column_name) AS count
FROM table_name
GROUP BY column_name
HAVING COUNT(column_name) > 1;
xxxxxxxxxx
SELECT OrderID, COUNT(OrderID)
FROM Orders
GROUP BY OrderID
HAVING COUNT(OrderID) > 1
xxxxxxxxxx
SELECT col,
COUNT(dupe_col) AS dupe_cnt
FROM TABLE
GROUP BY col
HAVING COUNT(dupe_col) > 1
ORDER BY COUNT(dupe_col) DESC