Re: [SQL] SQL (Venn diagram type of logic)

2006-07-12 Thread Aaron Bono
On 7/11/06, Vinnie Ma <[EMAIL PROTECTED]> wrote: Hello Aaron,Thank you for the help.  My apologies for the directemail but i couldn't figure out how to reply to thethread on the postresql site. Just doing a reply to all should send it to the mailing list but the from address must match the email ad

Re: [SQL] SQL (Venn diagram type of logic)

2006-07-04 Thread Aaron Bono
You can start by creating 3 views for your 3 categories:CREATE OR REPLACE VIEW cat_a (   account_id,   sales_cat_a) ASSELECT    account_id,    sum(sale_price) as sales_cat_aFROM   sales -- Assuming sales is the table with the dataWHERE   product_id in ('prod1', 'prod2')GROUP BY   account_idThen do

[SQL] SQL (Venn diagram type of logic)

2006-07-02 Thread Vinnie Ma
Hello everyone. I have a customer purchase table that keeps track of transaction details. I'm looking sum up total spent by each customer and classify each customer based on which products they bought. Data looks like... account_id, date, product_id, sale_price -