× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Also, take a look at pp. 405-407, Denormalize Normalized Data may be more
straightforward.

--
Loyd

On Fri, Jul 25, 2008 at 2:34 PM, <lgoodbar@xxxxxxxxxxxxxx> wrote:

Adam,

What you want looks like something similar to pp. 407-410 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 e-book (free) from his website:
http://mysite.verizon.net/Graeme_Birchall/id1.html

HTH,
Loyd

Loyd Goodbar
Business Systems
BorgWarner Shared Services
662-473-5713

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Adam Glauser
Sent: Friday, July 25, 2008 11:38 AM
To: midrange-l@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.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.