作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
SELECT COUNT(*) FROM `product` where barcode in (681155,
681144,
681145,
681146,
681147,
681148,
688123,
688124,
688125,
688126) GROUP BY(barcode);
这个语句如何使用count(*)?我得到所有行的 1
最佳答案
尝试:
SELECT COUNT(*) FROM `product`
where barcode in
(681155,
681144,
681145,
681146,
681147,
681148,
688123,
688124,
688125,
688126)
这将为您提供表格中的总数
当您使用 GROUP BY 时,它将对每个组进行计数。
SELECT barcode ,COUNT(*) FROM `product`
where barcode in (....)
Group by barcode
如果你对所有行都得到一个,那么你的表包含不同的条形码
关于mysql - 如何在mysql中使用count(*) WHERE IN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12315000/
我是一名优秀的程序员,十分优秀!