[英]Using the AND operating with an SQL COUNT() query
Is it possible to use the AND operator in an SQL COUNT() query? 是否可以在SQL COUNT()查询中使用AND运算符? For example: 例如:
SELECT COUNT(field1) AS count FROM table WHERE field1='value1' AND field2=value2'
Right now I'm getting a syntax error with that query. 现在,该查询出现语法错误。 Any advice? 有什么建议吗?
Yes: 是:
SELECT COUNT(*) AS count
FROM table
WHERE field1='value1'
AND field2='value2'; -- btw, you were missing the leading quote from value2
您会收到语法错误,因为在value2
之前省略了引号。
我来看看“ Read”这个词,似乎是保留的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.