找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

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

[数据库知识] 大家帮我看看看看SQL代码

[复制链接]
发表于 2009-11-29 14:21:19 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册账号

×

SELECT DispatchList.cDLCode AS 发货退货单号, DispatchList.dDate AS 发货日期, SaleBillVouch.cSBVCode AS 销售发票号, SaleBillVouch.dDate AS 开票日期, DispatchList.cCusName AS 客户名称, DispatchLists.cInvName AS 存货名称,

DispatchLists.iQuantity AS 发货数量, SaleBillVouchs.iQuantity AS 开票数量

from

DispatchLists left JOIN DispatchList on DispatchList.DLID = DispatchLists.DLID


inner JOIN
saleBillVouch ON DispatchList.cDLCode=salebillvouch.cdlcode


or
salebillvouch.cdlcode like '%'+','+DispatchList.cDLCode


or
salebillvouch.cdlcode like DispatchList.cDLCode+','+'%'


or
salebillvouch.cdlcode like '%,'+dispatchlist.cdlcode+',%'


inner JOIN
SaleBillVouchs
ON
SaleBillVouch.SBVID = SaleBillVouchs.SBVID


and
DispatchLists.cInvName=SaleBillVouchs.cInvName


and
salebillvouchs.idlsid=dispatchlists.idlsid

order by salebillvouch.csbvcode

 楼主| 发表于 2009-11-29 14:24:20 | 显示全部楼层
为什么实用内部连接进行销售发票与发货单主表进行连接呢,为什么不用外部连接呢?还有下面的 or 语句中like 与‘+’是什么意思呀?谢谢高手解答一下哦?inner JOIN saleBillVouch ON DispatchList.cDLCode=salebillvouch.cdlcode



or salebillvouch.cdlcode like '%'+','+DispatchList.cDLCode



or salebillvouch.cdlcode like DispatchList.cDLCode+','+'%'


or salebillvouch.cdlcode like '%,'+dispatchlist.cdlcode+',%'
 楼主| 发表于 2009-11-30 15:14:43 | 显示全部楼层
自己弄懂了,看来大家都不愿意交流SQL代码呀?
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

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

GMT+8, 2024-11-25 22:58 , Processed in 0.041451 second(s), 9 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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