Doing sum's if certain conditions are true

2006-08-29 Thread Ian Barnes
Hi, I am trying to build a query that does a sum if a certain parameter is set. For example: I have a row with four fields: code1, code2, duration and bytes. My current query looks something like this: SELECT code1 as code, sum(bytes) as bin, max(bytes) as min, avg(bytes) as ain, count(bytes)

RE: Doing sum's if certain conditions are true

2006-08-29 Thread Jay Blanchard
[snip] +---+--+---+-+-- +-+ | code | bin | min | ain | cin | dur | +---+--+---+-+-- +-+ |

Re: Doing sum's if certain conditions are true

2006-08-29 Thread Visolve DB TEAM
' and code2'denied' group by code1 Thanks Visolve Db team - Original Message - From: Ian Barnes [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Tuesday, August 29, 2006 3:26 PM Subject: Doing sum's if certain conditions are true Hi, I am trying to build a query that does a sum