您的位置:首页 > 其它

表字段处理

2006-02-20 22:21 176 查看
select substring(' '+项目+' ',id+1,charindex(' ',' '+项目+' ',id+1)-1-id) 项目,
(
select avg(金额)/count(项目)
from #t,table1
where
charindex(' ',' '+项目+' ',id)=id
and charindex(' ',' '+项目+' ',id+1)>id+1 and
项目=qq.项目
group by 项目
) 金额
from #t,table1 qq
where
charindex(' ',' '+项目+' ',id)=id
and charindex(' ',' '+项目+' ',id+1)>id+1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: