Why not simply use an aggregate function? Wouldn't that read more simply?