Q: How do you do this in SQL ?
Date: 1996/08/19
Message-ID: <3218E842.7FC7_at_informix.com>#1/1
I should know SQL better but for now can you please help me ?
I have a table
create table keywordclass (
It stores keyword hierarchies. Sample data is
How do you write a query in SQL that will retrieve the full
keyword hierarchy (tree) ? (Assuming that names are unique).
For example, retrieve the tree for "Animal", should return
What will be the query if keywords and class names could be
the same and duplicate ?
Thanks a lot for your time. I would appreciate if you could
send your reply as email.
Satish
Id integer,
KC char(1), // keyword or class ?
Name char(15),
Parent integer // refers to Id
);
1, 'C', 'Living', 1
2, 'C', 'Animal', 1
3, 'C', 'Plant', 1
4, 'K', 'Tiger', 2
5, 'C', 'Bird', 2
6, 'K', 'Parrot', 5
2, 'C', 'Animal', 1
4, 'K', 'Tiger', 2
5, 'C', 'Bird', 2
6, 'K', 'Parrot', 5
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Satish Katiyar Email : katiyar_at_informix.com
Informix Software, Inc. Work : (510) 873 - 8494
1111 Broadway, Suite 2000 Fax : (510) 873 - 6275
Oakland, California 94607 Home : (510) 769 - 6953
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Received on Mon Aug 19 1996 - 00:00:00 CEST