找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
楼主: gubing3370

SQL数据库语句问题

  [复制链接]
发表于 2011-3-23 22:02:11 | 显示全部楼层
语法有问题
回复

使用道具 举报

发表于 2011-5-12 22:41:09 | 显示全部楼层
看不懂,学习中
回复

使用道具 举报

发表于 2011-6-8 11:29:36 | 显示全部楼层
drop table jf_sa_fahuobiao
create table jf_sa_fahuobiao (cCuscode  VARCHAR(20), cCusName VARCHAR(98),isum  money,qc money)
Insert into jf_sa_fahuobiao (ccuscode,cCusName,isum,qc)
select x.cCuscode  ,max(x.cCusName ),sum(x.isum  ) from (
select DispatchList.cCuscode as cCuscode  ,DispatchList.cCusName cCusName, DispatchLists.isum as isum  from DispatchList right JOIN DispatchLists on DispatchList.DLID = DispatchLists.DLID WHERE (dDate >= CONVERT(DATETIME, '2009-11-17 00:00:00', 102)) and (dDate <= CONVERT(DATETIME, '2010-04-17 00:00:00', 102))
) x group  x.cCuscode  
回复

使用道具 举报

发表于 2011-6-8 11:32:45 | 显示全部楼层
drop table jf_sa_fahuobiao
create table jf_sa_fahuobiao (cCuscode  VARCHAR(20), cCusName VARCHAR(98),isum  money,qc money)
Insert into jf_sa_fahuobiao (ccuscode,cCusName,isum,qc)
select x.cCuscode  ,max(x.cCusName ),sum(x.isum  ) from (
select DispatchList.cCuscode as cCuscode  ,DispatchList.cCusName cCusName, DispatchLists.isum as isum  from DispatchList right JOIN DispatchLists on DispatchList.DLID = DispatchLists.DLID WHERE (dDate >= CONVERT(DATETIME, '2009-11-17 00:00:00', 102)) and (dDate <= CONVERT(DATETIME, '2010-04-17 00:00:00', 102))
) x group  x.cCuscode  
回复

使用道具 举报

发表于 2011-7-14 10:15:58 | 显示全部楼层
你写的语句比较混乱,下面是我整理好的语句,你看看
create table jf_sa_fahuobiao (cCuscode  VARCHAR(20), cCusName VARCHAR(98),isum  money,qc money)
Insert into jf_sa_fahuobiao (ccuscode,cCusName,isum,qc)
select DispatchList.cCuscode,DispatchList.cCusName, sum(DispatchLists.isum) isum,a.isum qc
from DispatchList
right JOIN DispatchLists on DispatchList.DLID = DispatchLists.DLID
inner join (select  sum(DispatchLists.isum) isum,ccuscode from DispatchList right JOIN DispatchLists on DispatchList.DLID = DispatchLists.DLID
       WHERE (dDate < CONVERT(DATETIME, '2009-11-17 00:00:00', 102))  and DispatchList.ccusname is not null
       GROUP BY ccuscode ) a on DispatchList.ccuscode = a.ccuscode

WHERE (dDate >= CONVERT(DATETIME, '2009-11-17 00:00:00', 102)) and (dDate <= CONVERT(DATETIME, '2010-04-17 00:00:00', 102))
and DispatchList.ccusname is not null
GROUP BY DispatchList.ccuscode,DispatchList.cCusName,a.isum
回复

使用道具 举报

发表于 2011-8-5 11:30:24 | 显示全部楼层
还是没有看懂 哎
回复

使用道具 举报

发表于 2011-10-24 21:50:09 | 显示全部楼层
来学习学习,请多多关照
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-11-21 23:59 , Processed in 0.043582 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表