select b.code_gender_oid,
b.code_race_oid,
b.code_region_oid,
avg(a.height),
stddev(a.height),
avg(a.height) - 1.96 * STDDEV(a.height) refa,
avg(a.height) + 1.96 * STDDEV(a.height) refb
from base_info b
left join physical_info a
on b.id = a.base_info_id
group by b.code_gender_oid, b.code_race_oid, b.code_region_oid