I am trying to do a count query that requires a group by. But when I get my results I am getting the correct amount of rows but with their tally in the total column instead of the amount of rows which is what I want.
SELECT Count(p.products_id) AS total
FROM products p
LEFT JOIN specials s
ON p.products_id = s.products_id
LEFT JOIN manufacturers m
ON p.manufacturers_id = m.manufacturers_id
JOIN products_description pd
ON p.products_id = pd.products_id
JOIN products_to_categories p2c
ON p.products_id = p2c.products_id
INNER JOIN products_specifications ps7
ON p.products_id = ps7.products_id
LEFT JOIN products_to_icon p2i
ON p.products_id = p2i.products_id
LEFT JOIN products_icons pi
ON p2i.icons_id = pi.icons_id
WHERE p.products_status = '1'
AND pd.language_id = '1'
AND ps7.specification IN ( 'Polycotton' )
AND ps7.specifications_id = '7'
AND ps7.language_id = '1'
GROUP BY p.products_id
What can I do to make it give me the total rows, instead of grouping the totals of each product ID as total.
Sample of what I am getting:
total
1
2
1
1
2
2
What I want:
total
6