Q&A about the site for those interested in the geology, meteorology, oceanography, and environmental sciences
CREATE TABLE #tab( Attribute1 VARCHAR(55) NOT NULL ,Attribute2 VARCHAR(55) NOT NULL ,Attribute3 VARCHAR(55) NOT NULL ,ID INT NOT NULL ); INSERT INTO #tab(ID,Attribute1,Attribute2,Attribute3) VALUES (1,'Glen Topson','AAX456', '16-02-2019 9:52:13'); INSERT INTO #tab(ID,Attribute1,Attribute2,Attribute3) VALUES (2,'craig slater','cox784', '16-02-2019 9:52:13'); INSERT INTO #tab(ID,Attribute1,Attribute2,Attribute3) VALUES (3,'Jim Beam','asdfa', '16-02-2019 9:52:13'); INSERT INTO #tab(ID,Attribute1,Attribute2,Attribute3) VALUES (4,'Cristal Wats','aax456', '16-02-2019 9:52:13'); INSERT INTO #tab(ID,Attribute1,Attribute2,Attribute3) VALUES (5,'Craig Slater','MBN062', '16-02-2019 9:52:13'); INSERT INTO #tab(ID,Attribute1,Attribute2,Attribute3) VALUES (6,'Jonno','adfadsss', '16-02-2019 9:52:13'); SELECT MAX(ID), Attribute1, Attribute2, MAX(Attribute3) FROM #tab GROUP BY Attribute1, Attribute2 --HAVING COUNT(1) > 1 ORDER BY 1, 2