Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Categories count SQL statement.


marcus76

Recommended Posts

Posted

Hi,

 

I have the following:

 

select count(*) as total from products p, products_to_categories p2c, products_attributes AS atr where p.products_id = atr.products_id AND atr.options_values_id in ('765','772') and p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '43' GROUP by p.products_id HAVING count(*)=2

 

The above returns 9 results (correct) however the 'total' count value = 2 . I believe the true count is getting skewed with the GROUP by p.products_id HAVING count(*)=2 in the statement.

 

Can someone pls suggest a method in which i can do a true count (returning 9) - a inner join perhaps? but where do i put this in my select statement.

 

Rgds

 

Marcus

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...