这是我的数据
newCatCols
=====
id sku name
---------------
1 4001 Black
2 4031 Red
3 4021 Black
4 4041 Blush
products
=====
id sku Price
---------------
1 4001 123
2 4031 232
3 4021 453
4 4041 233
这是我的查询
SELECT COUNT( * ) AS numTotal
FROM `products`
INNER JOIN `colors` ON `products`.`sku` = `colors`.`sku`
WHERE (
`name` = 'Apple_Black'
OR `name` = 'Black'
OR `name` = 'Black_Aubergine'
OR `name` = 'Black_Blush'
OR `name` = 'Black_Slate'
OR `name` = 'Black_Turquoise'
OR `name` = 'Red_Black'
OR `name` = 'Sapphire_Black'
OR `name` = 'Multi Apple'
)
AND `status` = '1'
AND `category` = 'sig'
GROUP BY `products`.`sku`
ORDER BY `products`.`rank` ASC
理想情况下,如果我只是改变这条线会是完美SELECT COUNT( * ) AS numTotal
的,只是修改它以使其工作?数据当前返回行值为 1 的产品列表,因此它只是循环而不计算所有行的总值。
它应该只显示返回的总数,例如应该显示 4
Output
=====
numTotal
---------------
4