select sum(money_fid) money,no from
(select * from t1
union
select * from t2 ) group by no;
(select * from t1
union
select * from t2 ) group by no;
解决方案 »
- 写了一个很简单的循环loop,但是一直报错,求大神解释啊
- sql先排序后分页求助
- 求助,存储过程调用出错
- oracle 链接 jsp
- 按照日期汇总数据,如果这一天没有数据,则统计的结果会漏掉这一天,但是把数据倒入Excel中,引用数据很容易出错。
- 请教一条SQL语句
- 关于oracle的sys及system用户的区别
- 在windows下如何启动数据库?
- 怎样insert 一个 long型数据 急!!!!!!!
- 谁有COM.ibm.db2.jdbc.app.DB2Drive驱动
- 请问检索两个Date类型的值大于某一指定天数的SQL语句怎么写。
- 怎么将ORACLE的两个模式下的表(在各模式下各表名同)关联起来?或JOIN?
房东方员工编号:cust1
房客方佣金:price2
房客方员工编号:cust2
select c.cust1,sum(c.price3+d.price4) from (
select sum(price1) price3,cust1 from tmp_ysj2
group by cust1) c,
(select sum(price2) price4,cust2 from tmp_ysj2
group by cust2) d
where c.cust1=d.cust2
group by c.cust1
inner join is wrong, what if d has a cust2 which not presents in c, then you already kick off some rows.