
fixed 
Adam,
What you want looks like something similar to pp. 407410 in Graeme
Birchall's DB2 SQL Cookbook. I checked in the latest version, for DB2
9.5. That example should work in V5R4 SQL.
For those with earlier editions, it's under Fun with SQL, Other Fun
Things, Transpose Numeric Data.
You can get Graeme's ebook (free) from his website:
http://mysite.verizon.net/Graeme_Birchall/id1.html
HTH,
Loyd
Loyd Goodbar
Business Systems
BorgWarner Shared Services
6624735713
Original Message
From: midrangelbounces@xxxxxxxxxxxx
[mailto:midrangelbounces@xxxxxxxxxxxx] On Behalf Of Adam Glauser
Sent: Friday, July 25, 2008 11:38 AM
To: midrangel@xxxxxxxxxxxx
Subject: Produce set of sets using SQL
Here is a simplified example which outlines the problem. Suppose we
have a table like this:
k1 k2 dest
a a 1
a a 2
a b 3
b c 4
b c 5
b c 6
(k1,k2) constitutes a unique identifier for a load, and each load has
one or more destinations. I would like to end up with ((1,2), (3),
(4,5,6)), that is, a set of all combinations of destinations which have
been stops on the same load. I'd then like to count how many loads have
used a particular combination, but that's probably best as a separate
step.
This mailing list archive is Copyright 19972015 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact