I recently answered this question how-to-call-user-defined-function-in-order-to-use-with-select-group-by-order-by
My answer was to use an inline view to perform the
From here: An inline view is a SELECT statement in the FROM-clause of another SELECT statement. In-line views are commonly used simplify complex queries by removing join operations and condensing several separate queries into a single query.