求教oracle 数据库 字段求和语句

[复制链接]
查看11 | 回复5 | 2011-10-18 03:47:00 | 显示全部楼层 |阅读模式
select t.bm,
(select count(*) from a where a.zl1=1 and a.bm=t.bm group by a.bm) as zl1,
(select count(*) from a where a.zl1=2 and a.bm=t.bm group by a.bm) as zl1,
(select count(*) from b where b.bm=t.bm group by b.bm) as qtfrom a tclwyzx希望有所提示,有空到51cto,365testing进一步交流!...
回复

使用道具 举报

千问 | 2011-10-18 03:47:00 | 显示全部楼层
select t.bm,
(select count(*) from a where a.zl1=1 and a.bm=t.bm group by a.bm) as zl1,
(select count(*) from a where a.zl1=2 and a.bm=t.bm group by a.bm) as zl1,...
回复

使用道具 举报

千问 | 2011-10-18 03:47:00 | 显示全部楼层
select sum(netweight) “净重合计” from weight;...
回复

使用道具 举报

千问 | 2011-10-18 03:47:00 | 显示全部楼层
sun(字段名称)...
回复

使用道具 举报

千问 | 2011-10-18 03:47:00 | 显示全部楼层
select sum(netweight) from weight...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行