|
|
Archives of the TeradataForum
Message Posted: Wed, 18 Aug 2004 @ 14:09:10 GMT
Subj: | | Matrix/Array query? |
|
From: | | Anomy Anom |
<-- Anonymously Posted: Wednesday, August 18, 2004 09:44 -->
Greetings Teradata Forum,
CREATE TABLE test_01
(NAME CHAR(04)
,SHIRT CHAR(01)
,PANTS CHAR(01)
,SOCKS CHAR(01)
,SHOES CHAR(01)
,HAT CHAR(01)
,COAT CHAR(01));
ins into test_01 ('JOHN', '0', '0', '0', '0', '0', '0');
ins into test_01 ('JOE ', '0', '1', '1', '1', '0', '0');
ins into test_01 ('JIM ', '1', '1', '0', '0', '0', '0');
ins into test_01 ('JACK', '1', '1', '1', '1', '0', '1');
From this sample table, I'm trying to write a query that would list one name/item pair for each appearance of a '1' in the database. For
example, the above table would give an output like this:
JOE PANTS
JOE SOCKS
JOE SHOES
JIM SHIRT
JIM PANTS
JACK SHIRT
JACK PANTS
JACK SOCKS
JACK SHOES
JACK COAT
Any suggestions? Thanks in advance for your help.
| |