Guest_imported
New member
- Jan 1, 1970
- 0
I am a new DB2 user. I am using DB2 UDB v7.
I need to create a second table from a table. Table 1 has multiple rows for each product in column 1 and non-numeric data in column 2. Table 2 needs to have 1 row for each distinct value in column 1 and be followed the first 10 values found from column 2. I have placed an example below.
I know this is not a traditional SQL problem. I would like to avoid writing a program with multiple SQL statements and non-sql logic.
Table 1
Prod# value
A a
A b
A c
A d
B a
B c
B d
B e
Table 2
Prod# val1 val2 val3 val4 val5 . . . . val10
A a b c d . . . . . . .
B a c d e . . . . . . .
[sig][/sig]
I need to create a second table from a table. Table 1 has multiple rows for each product in column 1 and non-numeric data in column 2. Table 2 needs to have 1 row for each distinct value in column 1 and be followed the first 10 values found from column 2. I have placed an example below.
I know this is not a traditional SQL problem. I would like to avoid writing a program with multiple SQL statements and non-sql logic.
Table 1
Prod# value
A a
A b
A c
A d
B a
B c
B d
B e
Table 2
Prod# val1 val2 val3 val4 val5 . . . . val10
A a b c d . . . . . . .
B a c d e . . . . . . .
[sig][/sig]