1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| CREATE TABLE B (id INT, e INT, f INT, h INT)
INSERT INTO B VALUES (10, 5, 6, 8)
INSERT INTO B VALUES (11, 5, 6, 9)
INSERT INTO B VALUES (12, 4, 6, 10)
INSERT INTO B VALUES (13, 2, 3, 10)
INSERT INTO B VALUES (14, 5, 6, 8)
SELECT *
FROM B AS T1
INNER JOIN (SELECT e, f
FROM B
GROUP BY e, f
HAVING COUNT(*) > 1) AS T2
ON T1.e = T2.e AND T1.f = T2.f
id e f h e f
----------- ----------- ----------- ----------- ----------- -----------
14 5 6 8 5 6
10 5 6 8 5 6
11 5 6 9 5 6 |
Partager