From: Tompkins Neil Date: August 31 2010 10:50am Subject: Re: MySQL SUM on two columns List-Archive: http://lists.mysql.com/mysql/222741 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=00c09fa2185fb40aad048f1c584a --00c09fa2185fb40aad048f1c584a Content-Type: text/plain; charset=ISO-8859-1 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://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.tompkins@stripped] > 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.products_id = products.products_id > WHERE products.enabled = 1 > AND products_sales.language = 'EN' > > This works fine, however I also want to SUM the ES language within the same > query. Is this possible to do, or should I just query the table twice, > replacing the language parameter ? > > Thanks. > > Neil > > > ---------------------------------------------------------------------- > Saloon gier - to nas wyroznia! > Sprawdz >>> http://linkint.pl/f27e0 > > --00c09fa2185fb40aad048f1c584a--