Added ORDER statement to check for latest revision of activity --> task relation.