如何从出生年月中统计出年龄,并计算出占总数的百分比?
CREATE TABLE #Test(id int, birth datetime)
INSERT INTO #Test select 1, '1978-10-12'
union all select 2, '1981-5-21'
union all select 3, '1975-12-3'
union all select 4, '1980-10-12'
如何从出生年月中统计出年龄,并计算出占总数的百分比?
例
年龄 百分比 数量
26 25% 1
27 25% 1