--查询
select c_ptid,F_STOCKSYS=isnull((
select sum(F_STOCKSYS) from bs_rep_day_lh
where D_date = '2004-8-1'
and c_ptid like a.c_ptid+'%'),0)
from bs_rep_day_lh a
where d_date = '2004-8-1'
select c_ptid,F_STOCKSYS=isnull((
select sum(F_STOCKSYS) from bs_rep_day_lh
where D_date = '2004-8-1'
and c_ptid like a.c_ptid+'%'),0)
from bs_rep_day_lh a
where d_date = '2004-8-1'
解决方案 »
- sql 2005怎么备份一张表数据到d盘
- 学习数据库的方法
- sql server profiler监测的sql语句问题
- 如何用SQL语句实现如下统计?不知道在原有基础上如何改动
- 客户端无法连接远程sqlserver2005 Analysis Service?
- 帮帮忙,看看这个递归怎么写
- 哪张系统表是记录哪个登陆帐号可以登陆哪个数据库的?
- OLE DB 提供程序 'msdaora' 报错。
- VS2005 + SQL2000 的数据库程序,写代码的机子可以连数据库,但在客户端机子却连不上
- 请问在SQL server中,如何将unicode-16转换成utf-8?
- 这样的sql语句怎么写?
- 问一个SQL,谢谢!
update a set F_STOCKSYS=isnull((
select sum(F_STOCKSYS) from bs_rep_day_lh
where D_date = '2004-8-1'
and c_ptid like a.c_ptid+'%'),0)
from bs_rep_day_lh a
where d_date = '2004-8-1'
select a.c_ptid,F_STOCKSYS=sum(b.F_STOCKSYS)
from bs_rep_day_lh a
left join bs_rep_day_lh b
on a.D_date = '2004-8-1'
and b.D_date = '2004-8-1'
and b.c_ptid like a.c_ptid+'%'
group by a.c_ptid
order by a.c_ptid