壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1865|回复: 2

[扩展开发|报表开发] Actuate报表中的两个SQL语句得出不同的结果,请问这个有区别吗?

[复制链接]
发表于 2007/7/29 11:06:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

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

x
语句1:
select workorder.wonum,
       workorder.description,
       workorder.location,
       workorder.assetnum,
       asset.description,
       locations.description,
       workorder.cwo36,
       workorder.cwo37,
       workorder.status,
       workorder.crewid,
       workorder.wolo4,
       workorder.statusdate,
       workorder.woqw6,
       workorder.wol3,
        a.changeby,
       a.changedate
from MAXIMO.workorder, MAXIMO.asset, MAXIMO.locations,
            (select c.wonum,c.changeby,c.changedate from   MAXIMO.wostatus c  
                      where c. status=\'YZWAPPR\' and c.wostatusid = (select max(b.wostatusid) from MAXIMO.wostatus b where b.wonum=c.wonum and b.status=\'YZWAPPR\')) a
where workorder.assetnum = asset.assetnum(+)
   and workorder.location = locations.location(+)
   and workorder.wonum=a.wonum(+)
   and 1 = 1

语句2:
select workorder.wonum,
       workorder.description,
       workorder.location,
       workorder.assetnum,
       asset.description,
       locations.description,
       workorder.cwo36,
       workorder.cwo37,
       workorder.status,
       workorder.crewid,
       workorder.wolo4,
       workorder.statusdate,
       workorder.woqw6,
       workorder.wol3,      
       a.changeby,
       a.changedate
from MAXIMO.workorder, MAXIMO.asset, MAXIMO.locations,
  (     select c.wonum,c.changeby,c.changedate from   MAXIMO.wostatus c,
           (Select wonum,max(changedate) changedate,status From  MAXIMO.wostatus Where status=\'YZWAPPR\' Group By wonum,status) b
            Where c.wonum=b.wonum And c.changedate=b.changedate And c.status=\'YZWAPPR\'
  ) a
where workorder.assetnum = asset.assetnum(+)
   and workorder.location = locations.location(+)
   and workorder.wonum=a.wonum(+)
   and 1 = 1

语句1能查出的数据能在报表中正确处理,而语句2的不能,不知道具体是什么原因,红色部分不同。

[ 本帖最后由 W39 于 2007-7-29 11:07 编辑 ]
发表于 2007/7/29 13:56:59 | 显示全部楼层
sql1得到的是最后或者最大changedate时间的记录,只会一条记录。SQL2可能会存在多条记录。
发表于 2007/7/29 16:43:00 | 显示全部楼层

回复 #2 yf6456 的帖子

有点道理!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/29 03:53 , Processed in 0.013573 second(s), 14 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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