Is it possible to use the AND operator in an SQL COUNT() query? For example:
SELECT COUNT(field1) AS count FROM table WHERE field1='value1' AND field2=value2'
Right now I'm getting a synt开发者_如何学运维ax 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
You'll get a syntax error because you've left out a quote mark before value2
.
I would take a look at the word "Read", seems to be reserved.
精彩评论