Get sql max datetime of multiple rows
===

This statement returns 2 rows:

 
   SELECT ts.UnitId,ts.TeststepId, MAX(ts.CreatedAt)as CreatedAt FROM Teststep ts
    INNER JOIN Unit u ON ts.UnitId = u.UnitId
     Where u.TemplateId = 2 Group by TeststepId,ts.UnitId

![enter image description here][1]


  [1]: http://i.stack.imgur.com/pa7CW.png

How can I get the one row with the highest CreatedAt date ? Should I distinct the unitId?