gpt4 book ai didi

mysql - 在 mysql 中为 count() 显示特定字符​​并显示它

转载 作者:行者123 更新时间:2023-11-29 00:08:06 25 4
gpt4 key购买 nike

我有这段代码试图显示描述值为"is"的用户名的数量

我的代码:

SELECT DISTINCT username, COUNT(description) 
FROM products GROUP BY username

*我试图添加//WHERE description = 'Yes'

但它显示并统计了描述中的所有数据。

我只想显示值为"is"的描述计数

最佳答案

试试这个查询

 SELECT count(*),username
FROM products
WHERE
description LIKE '%Yes%'
or
description LIKE '%yes%'
GROUP BY username

关于mysql - 在 mysql 中为 count() 显示特定字符​​并显示它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26574453/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com