[ASP]使用DB Access查询 [英] [ASP] Query with DB Access

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

问题描述

大家好。


我有这个查询ASP和Db访问:

Hi everyone.

I have this query ASP and Db Access:

展开 | 选择 | Wrap | 行号

推荐答案

你好mike1961,


问题是你的OR情况。使用OR用括号括起条件时需要注意。例如:
Hi mike1961,

The problem is your OR condition. You need to be careful when using an OR to surround the conditions with brackets. For example:
展开 | 选择 | Wrap | 行号


谢谢版主回复。


我有这个response.write查询:


[php]

SELECT Last(ID)AS ID,A,B,C,COUNT(D)AS TotD,最后(E)AS E,最后(F)AS F,最后(日期)AS日期,最后(tot)AS tot,最后(MonthName)AS MonthName,Last(IDMonth)AS IDMonth FROM tbl WHERE(((IDMonth = 12 )OR(IDMonth = 1)OR(月= 2)OR(IDMonth = 3))AND(日期>#2007/12/01#)AND(tot = 0)AND(EX =''KO'')AND (D不在(''SA​​''))和((E =''NT'')))GROUP BY D,A,B,C HAVING((COUNT(D))= 5)ORID BY ID asc

[/ php]


在数据库访问中,我有行 EX =''KO''和E =''NT'',但此查询不提取此行...
Thanks moderator for you reply.

I have this response.write query:

[php]
SELECT Last(ID) AS ID, A, B, C, COUNT(D) AS TotD, Last(E) AS E, Last(F) AS F, Last(date) AS date, Last(tot) AS tot, Last(MonthName) AS MonthName, Last(IDMonth) AS IDMonth FROM tbl WHERE (((IDMonth = 12) OR (IDMonth = 1) OR (Month = 2) OR (IDMonth = 3) ) AND (DATE > #2007/12/01#) AND (tot = 0) AND (EX = ''KO'') AND (D NOT IN (''SA'')) AND ((E = ''NT'') )) GROUP BY D, A, B, C HAVING ((COUNT(D)) = 5) ORDER BY ID asc
[/php]

In th DB Access I have rows whit EX = ''KO'' AND E = ''NT'' but this query not extract this rows...


您是否有查询分析器或类似的东西,您可以运行此查询来测试它?如果是这样,请执行此操作并逐个注释掉您的条件,直到您获得所期望的数据。这样你就会看到问题出在哪里。


我会猜测问题是AND(D NOT IN(''SA​​''))行所以开始那个。


让我知道它是怎么回事,


B博士
Have you got Query Analyser or something similar you can run this query in to test it? If so, do that and comment out your conditions one by one until you get the data returned you are expecting. That way you''ll see where the problem is.

I would hazard a guess that the problem is the AND (D NOT IN (''SA'')) line so start with that.

Let me know how it goes,

Dr B


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

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