select 时间=f,
门诊=sum(case f when 0 then 1 else 0 end),
住院=sum(case f when 1 then 1 else 0 end)
from t1
group by f
门诊=sum(case f when 0 then 1 else 0 end),
住院=sum(case f when 1 then 1 else 0 end)
from t1
group by f
门诊=(select count(1) from tb where f=1 and time=a.time),
住院==(select count(1) from tb where f=0 and time=a.time)
from t1 a
group by time
门诊=sum(case f when 1 then 1 else 0 end),
住院=sum(case f when 2 then 1 else 0 end),
其它=sum(case f when 3 then 1 else 0 end)
from t1
group by convert(char(10),时间,120)
是按日期统计工作量的
比如字段: 年龄和年龄类型
年龄 放 数字
年龄类型 放 字符 , 比如 '岁' '月' .怎么把2列合成1列显示
比如
age age_type
3 岁
表示 3岁
那么 我想这样显示
年龄
3岁