like thisSELECT results.[regelid] , results.[disciplineid]FROM ( SELECT v.[regelid] AS [regelid] , v.[disciplineid] AS [disciplineID] , ROW_NUMBER () OVER ( PARTITION BY v.[groupid], v.[regelid] ORDER BY v.[order] ASC ) AS [rowPos] FROM tblvolgordedisciplines AS v ) AS resultsWHERE results.[rowPos] = 1
-- FYI, it's generally considered bad form to have columns named after SQL KEYWORDS ([order]). It gets confusing.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION