设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 767|回复: 1
打印 上一主题 下一主题

[其它] SQL语句自动被修改并出错的问题,急求答案.

[复制链接]
跳转到指定楼层
1#
发表于 2007-4-19 02:01:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我有如下的SQL语句,在QUERY里能正常运行查询,当我把该查询引用到REPORT或FORM是,就出错,而且再到QUERY里运行该查询时,不能运行了.打开DESIGN界面看,该语句已经被自动修改,了.

select a.*,rtrim(iif(isnull(a.Sum_extload),0,round(a.Sum_ExtLoad/b.Sum_ExtLoad*100,2))) +'%' AS LoadPercengage from (select date,[assembly number],[product name],[commodity],sum ([Ext Load]) as Sum_Extload from FPS_Costbom group by date,[assembly number],[product name],[commodity]
union all
select date,[Assembly Number],[product name],'Total',sum([Ext load]) as Sum_ExtLoad from
FPS_COSTBOM group by date,[Assembly Number],[product name]) a inner join (select date,[assembly number],[product name],sum ([Ext Load]) as Sum_Extload from FPS_Costbom group by date,[assembly number],[product name])b ON (a.[Assembly Number]=b.[Assembly Number]) AND (a.date=b.date);

修改后为:

SELECT a.*, rtrim(IIf(isnull(a.Sum_extload),0,round(a.Sum_ExtLoad/b.Sum_ExtLoad*100,2)))+'%' AS LoadPercengage FROM [select date,[assembly number],[product name],[commodity],sum ([Ext Load]) as Sum_Extload from FPS_Costbom group by date,[assembly number],[product name],[commodity] UNION ALL select date,[Assembly Number],[product name],'Total',sum([Ext load]) as Sum_E] AS a INNER JOIN [select date,[assembly number],[product name],sum ([Ext Load]) as Sum_Extload from FPS_Costbom group by date,[assembly number],[product name]] AS b ON (a.date=b.date) AND (a.[Assembly Number]=b.[Assembly Number]);


显然有问题了.

请各位高手帮忙看看有什么问题啊,有没有什么建议.

[em06]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2007-4-19 08:28:00 | 只看该作者
要使不被更正,试试:工具/选项/常规/名称自动更正(中的各项打勾全去掉)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-12-2 02:56 , Processed in 0.106903 second(s), 25 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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