2
我需要爲具有重複的多部分標識符選擇某些字段。選擇帶有多部分標識符的內連接並具有子句
我有查詢搶重複正確的。
SELECT b.MemEmpID, b.LastName, b.FirstName
FROM table1 As b
GROUP BY b.MemEmpID, b.LastName, b.FirstName
HAVING Count(*) > 1
但找到重複後,我需要從同一個表,但僅適用於具有重複的多標識符攫取更多的信息。所以如下所示。
有人可以幫我用正確的語法呢?
SELECT a.memempid, a.depkey, a.lastname, a.firstname, a.birthdate, a.memrelation
FROM table1 As a
INNER JOIN(SELECT b.MemEmpID, b.LastName, b.FirstName
FROM table1 As b
GROUP BY b.MemEmpID, b.LastName, b.FirstName
HAVING Count(*) > 1)
ON b.memempid = a.memempid
AND b.lastname = a.lastname
AND b.firstname = a.firstname
非常感謝你!!!!我正在嘗試每一次,但這完美的工作! – user2136054 2013-03-05 15:13:10