我有这个代码试图显示用户名的计数,其中描述值为'是'仅
Mycode:
SELECT DISTINCT username, COUNT(description)
FROM products GROUP BY username
*which I trying to add//WHERE description = 'Yes'
但它显示并计算了描述中的所有数据。
我只想显示带有'是'
值的描述计数任何人都可以帮助我?
答案 0 :(得分:1)
尝试此查询
SELECT count(*),username
FROM products
WHERE
description LIKE '%Yes%'
or
description LIKE '%yes%'
GROUP BY username
答案 1 :(得分:0)
这应该为你做....
SELECT count(*),username
FROM products
WHERE description = 'yes'
GROUP BY username