Add end date as well to sorting SQL.