Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
sql查询-在where子句中使用多个条件的sql where子句_Sql_Vba_Ms Access - Fatal编程技术网

sql查询-在where子句中使用多个条件的sql where子句

sql查询-在where子句中使用多个条件的sql where子句,sql,vba,ms-access,Sql,Vba,Ms Access,我是VBA新手。我的数据库是Ms access。我编写查询是为了根据四个条件从数据库中提取数据 我的数据库: KeyerName Job score date time xxx 1 50 12/14/13 02:30 yyy 1 60 01/02/14 12:00 xxx 4 75 02/08/14 08:00 xxx 4 50

我是VBA新手。我的数据库是Ms access。我编写查询是为了根据四个条件从数据库中提取数据

我的数据库:

KeyerName    Job   score  date      time
xxx           1     50    12/14/13  02:30
yyy           1     60    01/02/14  12:00
xxx           4     75    02/08/14  08:00  
xxx           4     50    02/08/14  08:00  
yyy           1     90    01/02/14  12:00
我想提取我的数据作为基于日期、时间、工作和keyername的分数总和

我将sql查询编写为

ssql= "select sum(score) from typt where Keyername='XXX', Job ='4', date=#02/08/14#, time= '08:00'"
然而,我收到了错误。 我的输出是:

score  
 125   
有人能建议我如何在where子句sql中使用多个条件吗?
提前感谢。

将每个逗号替换为和:

select sum(score) from typt where Keyername='XXX' AND Job ='4' AND ...

你好,谢谢你的回复,我试过了。但它返回错误“对象不支持属性或方法”。如何使用多个条件..我想我们需要看更多的代码。您提供的只是用于形成查询的字符串。很明显,你还有别的地方不成功。另外-调试技巧-将代码剥离到最简单的部分,然后看看是否有效。示例-删除“where”子句,看看是否得到所有分数的总和。然后一次加一个critieria