写个sql语句,列出每个地区有多少个年龄的人。
------解决方案--------------------
- SQL code
select substring(col,1,6) as 地区, count(datepart(getdate())-cast(substring(col,7,4) as int)) as 人数from tbgroup by substring(col,1,6)
select substring(col,1,6) as 地区, count(datepart(getdate())-cast(substring(col,7,4) as int)) as 人数from tbgroup by substring(col,1,6)