如何在mysql中对同一字段进行多次计数?下面的单个计数代码工作正常
SELECT fruit, COUNT(DISTINCT site) AS `apple` FROM grocery where fruit like '%06201%'
但是,当我尝试过这个但我得到语法错误
SELECT
SUM(fruit like '%06201%') AS `apple`,
SUM(fruit like '%02206%') AS `pears`,
FROM grocery
如何在mysql中对同一字段进行多次计数?下面的单个计数代码工作正常
SELECT fruit, COUNT(DISTINCT site) AS `apple` FROM grocery where fruit like '%06201%'
但是,当我尝试过这个但我得到语法错误
SELECT
SUM(fruit like '%06201%') AS `apple`,
SUM(fruit like '%02206%') AS `pears`,
FROM grocery