grouping/clustering query

Поиск
Список
Период
Сортировка
От David Garamond
Тема grouping/clustering query
Дата
Msg-id 7c33d060810212214h5c85b406i49dd9e8d76bec9bd@mail.gmail.com
обсуждение исходный текст
Список pgsql-sql
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. Example:

# (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]

Regards,
dave


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Ryan Hansen"
Дата:
Сообщение: Full Text Index Stats
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: Full Text Index Stats