views:

69

answers:

1

I want to display total number of products sold for each product. There are around 30 products in my virtue mart and I want each one's total sold number.

Table named jos_vm_order_item contains product_id and product_quantity with all other information.

How can I display this?

Please Help me out its very urgent for me.....

Thanks in advance...

+2  A: 
SELECT O.product_id,
       SUM(O.product_quantity) as Total_Sold
  FROM jos_vm_order_item O
 GROUP BY O.product_id
Mark Baker
by this query i am getting the sum in phpmyadmin but not on front-end...
Rachel
I'm not a joomla expert. If you're retrieving the row data as an associative array, then it should be in $row['Total_Sold']
Mark Baker
thanks mark...it is done...
Rachel