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
Sorry I don't want to SUM the varchar columns. This is the parameter passed that defines the two different queries. On Tue, Aug 31, 2010 at 11:48 AM, misiaQ wrote: > I don't think that SUM will work for varchar columns. > If I got your point right - you need to use WITH ROLLUP grouping > http

RE: MySQL SUM on two columns

2010-08-31 Thread misiaQ
I don't think that SUM will work for varchar columns. If I got your point right - you need to use WITH 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...@