Ich versuche, die anderen KeyLocationIDs
von der NumberOfDuplicates
zu bekommen. Ich möchte die Min(KeyLocationID)
ausschließen und möchte eine Liste der anderen.Schnappen Sie sich alle IDs mit Ausnahme von Min Wert
select CompanyID, Location, EventCode, count(*) as NumberOfDuplicates, min(KeyLocationID) as KeepThisOne
from trip.KeyLocations
group by CompanyID, Location, EventCode
having count (*) > 1
order by location asc
WHERE KeyLocationID> min (KeyLocationID) '' vor GROUP BY' –