Sum If - Mailing list pgsql-sql

From Daniel Hernandez
Subject Sum If
Date
Msg-id 20060223174644.073502F616@xprdmxin.myway.com
Whole thread Raw
Responses Re: Sum If
List pgsql-sql
Hi Guys,<br /><br />�� I'm new on this group, and I have a question, is there a way to do a "sum if" (kind of)?<br
/><br/>What i want to do is the following.<br /><br />Select customers.custid, if (sales.itemname = 'candy',
sum(sales.count))as "Sales candies", if (sales.itemname = 'some', sum(sales.count)) as "Sales Some"<br />from ...<br
/>join...<br />where .....<br />group by customers.custid ...<br /><br /><br />Thanks in advanced, and best regards,<br
/><br/><br />Daniel Hern�ndez.<br />Tijuana, BC, M�xico.<br />"More you learn, more you earn".<p><hr /><font
face="geneva"size="2"><b>Join Excite! - <a href="http://www.excite.com"
target="_blank">http://www.excite.com</a></b><br/>The most personalized portal on the Web!</font> 

pgsql-sql by date:

Previous
From: PFC
Date:
Subject: Re: 'locking' the SELECTs based on indices...
Next
From: "Jim Buttafuoco"
Date:
Subject: Re: Sum If