Sum If

From: "Daniel Hernandez" <breydan(at)excite(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Sum If
Date: 2006-02-23 17:46:44
Message-ID: 20060223174644.073502F616@xprdmxin.myway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Guys, I'm new on this group, and I have a question, is there a way to do a &quot;sum if&quot; (kind of)?What i want to do is the following.Select customers.custid, if (sales.itemname = 'candy', sum(sales.count)) as &quot;Sales candies&quot;, if (sales.itemname = 'some', sum(sales.count)) as &quot;Sales Some&quot;from ...join ...where .....group by customers.custid ...Thanks in advanced, and best regards,Daniel Hernndez.Tijuana, BC, Mxico.&quot;More you learn, more you earn&quot;.

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!

Responses

  • Re: Sum If at 2006-02-23 18:09:33 from Jim Buttafuoco

Browse pgsql-sql by date

  From Date Subject
Next Message Jim Buttafuoco 2006-02-23 18:09:33 Re: Sum If
Previous Message PFC 2006-02-23 16:35:21 Re: 'locking' the SELECTs based on indices...