查询结果 [英] Query Results

查看:77
本文介绍了查询结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基本上按日期运行报告的查询。因此,我每个月进入并运行我的结果都有以下列:

日期

TO:计数(账户数量)

金额:总和(金额)

除了:Where Like2 (对于我的输入表上的异常框,显示是/否,如果是异常(是),则默认为2,我将提取数据以查看当月是否有任何例外情况。)


然而,当我运行我的报告时,这是我第一次出现没有帐户设置为是的情况。然后说我的报告有错误并且没有填写任何内容,我需要我的报告来反映某些内容。有没有办法在我的查询或我的报告中我可以运行它并且如果当月没有例外,它将反映0(零)TO或金额?

I have a Query that essentially runs a report by date. So every month I go in and run my results have the following columns:
Date
TO: Count(Account Num)
Amount: Sum(Amount)
Except: Where Like "2" (which is for the Exception box on my input sheet that says Yes/No and If it is an exception (Yes) it defaults to 2 and I am pulling the data to see if there were any exceptions for the month.)

However, when I run my report this is the first time I had an occurence where there weren''t any accounts set to Yes. and then says there is an error on my report and doesn''t fill out anything and I need my report to reflect something. Is there a way either in my query or my report that I can run this and it will reflect 0 (Zero) for TO or Amount if there were no exceptions for the month??

推荐答案

你能粘贴你正在使用的查询的实际SQL吗?


基本上我认为你最终会使用和IIF()语句来填写0值,但我们能够在看到SQL后更好地说出来。


请在粘贴后包括[code]标签,方法是选择所有SQL文本并单击此回复窗口顶部的#按钮。谢谢!


问候,

Scott
Could you paste in the actual SQL of the query you are using?

Basically I think you''ll end up using and IIF() statement to fill out the 0 value, but we''ll be able to tell better after seeing the SQL.

Please include the [code] tags after pasting by selecting all the SQL text and clicking on the # button on the top of this reply window. Thanks!

Regards,
Scott



你能不能粘贴在你正在使用的查询的实际SQL中?


基本上我认为你最终会使用和IIF()语句填写0值,但我们''看到SQL后能够更好地说出来。


请在粘贴后包括[code]标签,方法是选择所有SQL文本并单击此回复窗口顶部的#按钮。谢谢!


问候,

Scott
Could you paste in the actual SQL of the query you are using?

Basically I think you''ll end up using and IIF() statement to fill out the 0 value, but we''ll be able to tell better after seeing the SQL.

Please include the [code] tags after pasting by selecting all the SQL text and clicking on the # button on the top of this reply window. Thanks!

Regards,
Scott



对不起,试图说出我需要的东西而不是粘贴这个大的SQL文本。希望你还能帮助我。我迷失了。我知道这个SQL有效,因为我在1月份从表(a)得到2个结果,我已经检查为是(2)并且它提升了我的报告就好了。但是,我正在进行第二次测试并运行它,它没有任何结果设置为2,它在我的查询中没有任何内容。我试图这样做,如果语句iif((a.NAcctnum)IS NULL,0,Count(a.Nacctnum)),但它没有采取它。我花了3个小时试图弄清楚这一件事并没有到达任何地方。我也试过了一个CASE WHEN声明,但这似乎也没有用。



Sorry, was trying to say what I needed instead of pasting this big SQL text. Hope you can still help me. I am lost on this. I know this SQL works because I have 2 results in January from table (a) that I have checked as Yes (2) and it pulled up my report just fine. However, I came accross doing my second test and running it that it didn''t have any results set to 2 that it had nothing there in my query. I tried to do this if statement iif((a.NAcctnum)IS NULL, "0", Count(a.Nacctnum)) but it didn''t take it. I have spent 3 hours trying to figure this one thing out and haven''t gotten anywhere. I also tried a CASE WHEN statement but that didn''t seem to work either.


展开 | 选择 | Wrap | 行号


正确的语法是:


IIF(Isnull(a.NAcctnum),0,伯爵(a.NAcctnum))


试一试!


问候,

Scott
The correct syntax would be:

IIF(Isnull(a.NAcctnum), "0", Count(a.NAcctnum))

Give that a try!

Regards,
Scott


这篇关于查询结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆