如何在同一个 select 中使用函数结果两次

How to use function result twice in the same select

我有一个存储过程,我需要在其中 return 两个函数结果和两者的平均值,我怎样才能只调用它们一次以获得结果?

Select 
    get_valueX(jobId, c.id), 
    get_valueY(jobId, c.id), 
    (get_valueX(jobId, c.id) + get_valueY(jobId, c.id)) / 2, 
    c.name 
From candidate c

(将程序代码减少到只需要代码才能看到问题,jobId 也是程序的输入变量)

Select x, y, name, (x + y)/2 As xy_avg
From (
  Select 
    get_valueX(jobId, c.id) As x, 
    get_valueY(jobId, c.id) As y, 
    c.name
  From candidate c
) As t;