Re: MySQL SUM on two columns

2010-08-31 Thread Tompkins Neil
Hi, I also wondered, if there is any way to LIMIT the products.rating for each language to say the top 25 ? Cheers Neil On Tue, Aug 31, 2010 at 12:11 PM, Tompkins Neil < neil.tompk...@googlemail.com> wrote: > Perfect. Exactly what I was looking for. > > Cheers John. > > Regards, > Neil > > On

Re: MySQL SUM on two columns

2010-08-31 Thread Tompkins Neil
Perfect. Exactly what I was looking for. Cheers John. Regards, Neil On Tue, Aug 31, 2010 at 12:06 PM, John Daisley wrote: > SELECT products_sales.language, SUM(products.rating) AS products_rating > > FROM products_sales > INNER JOIN products ON products_sales.products_id = products.products_id

Re: MySQL SUM on two columns

2010-08-31 Thread John Daisley
SELECT products_sales.language, SUM(products.rating) AS products_rating FROM products_sales INNER JOIN products ON products_sales.products_id = products.products_id WHERE products.enabled = 1 AND products_sales.language IN ('EN','ES') GROUP BY products_sales.language Will give the sum for each la

Re: MySQL SUM on two columns

2010-08-31 Thread Tompkins Neil
ROLLUP grouping > http://dev.mysql.com/doc/refman/5.0/en/group-by-modifiers.html > > see second example on that page. > > regards, > m > > -Original Message- > From: Tompkins Neil [mailto:neil.tompk...@googlemail.com] > Sent: Tuesday, August 31, 2010 11:43 AM >

RE: MySQL SUM on two columns

2010-08-31 Thread misiaQ
tompk...@googlemail.com] Sent: Tuesday, August 31, 2010 11:43 AM To: [MySQL] Subject: MySQL SUM on two columns Hi, I've the following basic SUM for our products based on a rating. SELECT SUM(products.rating) AS products_rating FROM products_sales INNER JOIN products ON products_sales.p

MySQL SUM on two columns

2010-08-31 Thread Tompkins Neil
Hi, I've the following basic SUM for our products based on a rating. SELECT SUM(products.rating) AS products_rating FROM products_sales INNER JOIN products ON products_sales.products_id = products.products_id WHERE products.enabled = 1 AND products_sales.language = 'EN' This works fine, however