I have query like
SELECT COUNT( * ) As Publishid164 FROM `comments` WHERE `publishid` =164
it will get Count of One publishid=164
But I wanted to pass more plublish id like
SELECT COUNT( * ) Publishid FROM `comments` WHERE `publishid` IN (164,165)
But I wanted different counts of publish id
How can i do that
Thanks in advance
if you need a count for each publishid you must group by
SELECT COUNT( * )
FROM comments
WHERE publishid IN (164,165)
GROUP BY publishid
of if you need also publishid column
SELECT publishid, COUNT( * )
FROM comments
WHERE publishid IN (164,165)
GROUP BY publishid
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.