| 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: | Whole Thread | Raw Message | 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 "sum if" (kind of)?What i want to do is the following.Select customers.custid, if (sales.itemname = 'candy', sum(sales.count)) as "Sales candies", if (sales.itemname = 'some', sum(sales.count)) as "Sales Some"from ...join ...where .....group by customers.custid ...Thanks in advanced, and best regards,Daniel Hernndez.Tijuana, BC, Mxico."More you learn, more you earn".
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
| 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... |