Office中国论坛/Access中国论坛
标题:
[求助]急问关于查询“溢出”的问题!
[打印本页]
作者:
ellacong
时间:
2006-1-27 01:51
标题:
[求助]急问关于查询“溢出”的问题!
请各位高手帮我看看这个数据库文件中名为"Calculation"的查询,为什么在运行时会“溢出”呢?其他两个查询都是没问题的啊,真是奇怪呀,我已经被这个问题困扰了三天了,想破了头也没找到解决的办法,只有求助于大家了,请大家千万帮忙啊!!!我等,在线等!
[em06][em06][em06][attach]15586[/attach]
[此贴子已经被作者于2006-1-27 5:29:41编辑过]
作者:
sgrshh29
时间:
2006-1-27 19:00
SELECT [1 COL Query].Year, [1 COL Query].Month, [1 COL Query].Brand, IIf([1-1]>0,IIf([1-2]>0,(([1-1]-[1-2])/[1-1]),0),0) AS [2-1], IIf([1-1]>0,(DSum("[1-1]","[1 col query]","brand='" & [target query].[brand] & "'and year=" & [target query].[year] & " and month<=" & [target query].[month])-DSum("[1-2]","[1 col query]","brand='" & [target query].[brand] & "'and year=" & [target query].[year] & " and month<=" & [target query].[month]))/DSum([1-1],"[1 col query]","brand='" & [target query].[brand] & "'and year=" & [target query].[year] & " and month<=" & [target query].[month]),0) AS [2-1-1], [Target Query].[2-1-3]
FROM [1 COL Query] INNER JOIN [Target Query] ON ([1 COL Query].Brand = [Target Query].Brand) AND ([1 COL Query].Year = [Target Query].Year) AND ([1 COL Query].Month = [Target Query].Month)
ORDER BY [1 COL Query].Brand, [1 COL Query].Year, [1 COL Query].Month;
作者:
ellacong
时间:
2006-1-28 04:04
谢谢!但还是有些不对的地方——少了几条记录。查询结果应该是96条记录,但我输入修改后的代码,再运行就只有78条记录了,好奇怪呀!
[em06]
作者:
sgrshh29
时间:
2006-1-28 17:41
因为你的表Target中的Brand数据有错误,与另一个表不一致.
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3