I have a table with data similar to the following:
The longer I work on this, the uglier my SQL is getti
Another one:
http://sqlfiddle.com/#!6/fd219/1
SELECT t.State, MAX(t.foo), MAX( COALESCE( t.DateUpdated, t.DateCreated )) FROM t GROUP BY t.State HAVING COUNT(DISTINCT t.foo) = 1;