Fwd: [SQL] grouping/clustering query

2008-10-27 Thread Osvaldo Kussama
I forgot the list. -- Forwarded message -- From: Osvaldo Kussama <[EMAIL PROTECTED]> Date: Mon, 27 Oct 2008 12:28:57 -0200 Subject: Re: [SQL] grouping/clustering query To: David Garamond <[EMAIL PROTECTED]> 2008/10/24, David Garamond <[EMAIL PROTECTED]>:

Re: [SQL] grouping/clustering query

2008-10-24 Thread David Garamond
Tony, Joe, Steve, Thanks for the follow-ups. Yes, the problem is related to double-entry accounting, where one needs to balance total debit and credit (payments and invoices) in each journal/transaction. Due to time constraint, I ended up doing this in the client-side programming language, since

Re: [SQL] grouping/clustering query

2008-10-24 Thread Tony Wasson
On Fri, Oct 24, 2008 at 10:24 AM, Tony Wasson <[EMAIL PROTECTED]> wrote: > On Fri, Oct 24, 2008 at 8:04 AM, Steve Midgley <[EMAIL PROTECTED]> wrote: >> At 11:28 AM 10/23/2008, Joe wrote: >>> >>> Steve Midgley wrote: > > # (invoiceid, txid) > (A, 1) > (A, 3) > (B, 1) > (B, 2)

Re: [SQL] grouping/clustering query

2008-10-24 Thread Tony Wasson
On Fri, Oct 24, 2008 at 8:04 AM, Steve Midgley <[EMAIL PROTECTED]> wrote: > At 11:28 AM 10/23/2008, Joe wrote: >> >> Steve Midgley wrote: # (invoiceid, txid) (A, 1) (A, 3) (B, 1) (B, 2) (C, 5) (D, 6) (D, 7) (E, 8) (F, 8) For journalli

Re: [SQL] grouping/clustering query

2008-10-24 Thread Oliveiros Cristina
From: "Steve Midgley" <[EMAIL PROTECTED]> To: "Joe" <[EMAIL PROTECTED]> Cc: ; "David Garamond" <[EMAIL PROTECTED]> Sent: Friday, October 24, 2008 4:04 PM Subject: Re: [SQL] grouping/clustering query At 11:28 AM 10/23/2008, Joe wrote: Steve Midgle

Re: [SQL] grouping/clustering query

2008-10-24 Thread Steve Midgley
At 11:28 AM 10/23/2008, Joe wrote: Steve Midgley wrote: # (invoiceid, txid) (A, 1) (A, 3) (B, 1) (B, 2) (C, 5) (D, 6) (D, 7) (E, 8) (F, 8) For journalling, I need to group/cluster this together. Is there a SQL query that can generate this output: # (journal: invoiceids, txids) [A,B] , [1,2,3

Re: [SQL] grouping/clustering query

2008-10-23 Thread Joe
Steve Midgley wrote: # (invoiceid, txid) (A, 1) (A, 3) (B, 1) (B, 2) (C, 5) (D, 6) (D, 7) (E, 8) (F, 8) For journalling, I need to group/cluster this together. Is there a SQL query that can generate this output: # (journal: invoiceids, txids) [A,B] , [1,2,3] [C], [5] [D], [6,7] [E,F], [8] Hi

Re: [SQL] grouping/clustering query

2008-10-23 Thread Steve Midgley
At 10:20 PM 10/22/2008, you wrote: Message-ID: <[EMAIL PROTECTED]> Date: Wed, 22 Oct 2008 12:14:49 +0700 From: "David Garamond" <[EMAIL PROTECTED]> To: pgsql-sql@postgresql.org Subject: grouping/clustering query X-Archive-Number: 200810/89 X-Sequence-Number: 31731 Dear all, I have an invoices

[SQL] grouping/clustering query

2008-10-21 Thread David Garamond
Dear all, I have an invoices (inv) table and bank transaction (tx) table. There's also the payment table which is a many-to-many relation between the former two tables, because each invoice can be paid by one or more bank transactions, and each bank transaction can pay for one or more invoices. Ex