你试试,我这里不能试 select a.xh,sum(a.cj*b.xf)/sum(b.xf)
from xk a,kc b
where a.kch=b.kch
group by a.xh
from xk a,kc b
where a.kch=b.kch
group by a.xh
解决方案 »
- datetime格式与getdate()函数的问题
- 请问DB-Library for C还能支持SQL Server 2008吗?
- 请教一个sql语句查询
- sql2005表
- 想把字段的值在原来的值的基础上加1,可以只用UPDATE搞定吗?还是要先SELECT然后把原值读出来加1后再UPDATE?
- 这样的SQL语句是不是效率很差,请问大哥们怎么优化?
- 有关SQL循环执行的问题
- 有关oracle
- 求一条SQL语句,谢谢!
- update 能不能一次更新所有字段!(就象insert into table1 select * from table2一样)??
- 新手,刚开始上路。请问各位高手这个存储过程那里出错,谢谢!
- 按装问题
from (select xk.xh,sum(xk.cj*kc.xf)/sum(kc.xf) 绩点 from xk join kc on xk.kch=kc.kch
group by xk.xh) t join xs on t.xh=xs.xh
from xk a,kc b
where a.kch=b.kch
group by a.xh
order by 绩点 desc
from (select xk.xh,sum(xk.cj*kc.xf)/sum(kc.xf) 绩点 from xk join kc on xk.kch=kc.kch
group by xk.xh) t
join xs on t.xh=xs.xh--测试结果
/*
xh xm others px
-------- -------- ---------------------------------------------------------------------------------------------------- ------
00010001 zxx ...... 86.2
00010002 lxx ...... 89.5
00010003 wxx ...... 89.5
00010004 qxx ...... NULL(所影响的行数为 4 行)
*/