我有个问题,帮我解答一下 SELECT qty,qty4=(SELECT SUM(qty) FROM tb WHERE qty<=A.qty)FROM tb AS A 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 create table #1 (qty int,qty3 int)insert #1 values(1,1)insert #1 values(2,2)insert #1 values(3,3)select qty,qty4 = (select sum(qty3) from #1 where qty <= a.qty)from #1 a/*qty qty4----------- -----------1 12 33 6(3 row(s) affected)*/ 写一个SQL语句问题 SQL server 2005 读/写操作频繁 求救:SQL面试题 求删除重复记录的SQL语句~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~在线等 我想写一个带表名参数的存储过程怎么写? 如何实现以下功能? 急,请教高手指点SQL语句 查询一个数据库下所有表的数据??急,在线等! msde连接问题 这是什么问题? 备份文件恢复数据库过程中的问题,请教下大家 数据库设计问题
create table #1 (qty int,qty3 int)
insert #1 values(1,1)
insert #1 values(2,2)
insert #1 values(3,3)select qty,
qty4 = (select sum(qty3) from #1 where qty <= a.qty)
from #1 a
/*
qty qty4
----------- -----------
1 1
2 3
3 6(3 row(s) affected)*/