userid testid catid correct incorrect 2 1 1 18 NULL 2 1 2 1 NULL 2 1 1 NULL 5 2 1 2 NULL 1
userid testid catid correct incorrect 2 1 1 18 5 2 1 2 1 1
SELECT userid, testid, catid, max(correct), max(incorrect) FROM [your table] GROUP BY userid, testid, catid
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)