Re: Multiple sums in a single select?

2005-04-15 Thread SGreen
Kendall Bennett <[EMAIL PROTECTED]> wrote on 04/14/2005 06:55:02 PM: > Hi Guys, > > I am trying to work out if it is possible to create a select statement > that will sum table data into columns with different criteria and have > it all in one select statement. For instance I have the followin

RE: Multiple sums in a single select?

2005-04-14 Thread Kostas Pyliouras
You can use an IF in a SUM if you add them based on special conditions: e.g.: SUM(IF(field = 1, field_to_sum, 0)) -Original Message- From: Kendall Bennett [mailto:[EMAIL PROTECTED] Sent: Donnerstag, 14. April 2005 23:55 To: mysql@lists.mysql.com Subject: Multiple sums in a single

Multiple sums in a single select?

2005-04-14 Thread Kendall Bennett
Hi Guys, I am trying to work out if it is possible to create a select statement that will sum table data into columns with different criteria and have it all in one select statement. For instance I have the following that computes the quantity of a product sold within the last 60 days: select o