Jim
次の結果でが重複するのはなぜですか?
CREATE TABLE #B (Name VARCHAR(10), Age INT)
INSERT INTO #B
values
('Jim', 21),
('Jim', 21),
('Jim', 19),
('Jim', 20),
('Nick', 20),
('Nick', 2),
('Nick', 20);
SELECT DISTINCT
Name,
Age
FROM #B A
WHERE EXISTS
(
SELECT 1
FROM #B B
WHERE A.Age > B.Age
AND A.NAME = B.NAME
)