473,500 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set level acestor report; DB2 UDB 8.1.9 Linux

From a table like the one below, is there an easy (ha ha) way to get a
set level of pedigree (3 or 5 generations, say?). I have seen solutions
on this group for all the ancestors, but, unless I misunderstood, no
solution for a fixed number of generations. There is always the 2^n way
join for n generations, but I'm looking for something a little simpler
and not so fast growing in term of n. To make things easier? animal 0 is
its own parents, and the parent of all animals whose parent(s) is(are)
unknown. Right now, I am solving the three generation problem with a
recursive php function, but I am looking for a non-procedural sql solution.
create table t (
animal_id integer,
sire_id integer,
dam_id integer,
namex varchar(40),
<lots of other stuff>,
primary key (animal_id) )
alter table t
add constraint sire_id
foreign key(sire_id)
references t(animal_id)
alter table t
add constraint dam_id
foreign key(dam_id)
references t(animal_id)
Mar 29 '06 #1
2 1306
In article <at*************@fe03.lga>, rs**********@charter.net says...
From a table like the one below, is there an easy (ha ha) way to get a
set level of pedigree (3 or 5 generations, say?).


One of my favorite replies :)

Download (and read) the DB2 UDB Cookbook from Graeme Birchall (page 299,
recursive queries) from
http://mysite.verizon.net/Graeme_Birchall/id1.html

Mar 29 '06 #2
Gert van der Kooij wrote:
In article <at*************@fe03.lga>, rs**********@charter.net says...
From a table like the one below, is there an easy (ha ha) way to get a
set level of pedigree (3 or 5 generations, say?).

One of my favorite replies :)

Download (and read) the DB2 UDB Cookbook from Graeme Birchall (page 299,
recursive queries) from
http://mysite.verizon.net/Graeme_Birchall/id1.html

Thank you for the reply/pointer.

While I only read the recommended chapter, I would recommend it to any
one using DB2. It is clearly written, with copious examples.

The given solutions, as I read the chapter, contain 1 row for each
individual in the ancestor tree. What if I want 1 row for the scion with
all of the ancestors, perhaps in some given order?
Mar 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3886
by: xtanto | last post by:
Hi All, We need to develope application & report that run on windows accessing Oracle on Linux. and we use Crystal Report as reporting tool. Can Crystal Report on windows access...
1
1001
by: Alex Stevens | last post by:
Hi All, I have implemented my own toolbar on a form which houses the crystal reprot viewer. I would like to have a combobox to allow the user to change the zoom level to say 25 / 50 / 75 / 100...
4
3733
by: eliffman | last post by:
I get the following error when trying to run a report: Multi-level GROUP BY clause is not allowed in a subquery. (Error 3612) The report's recordsource is a query based on a single table....
1
7185
by: Tim Marshall | last post by:
A2003. I am getting this error message when I try to set a report's recordsource to an SQL statement or a saved querydef that uses sub-queries. I've debug.printed the SQL, and run it as a stand...
14
1866
by: Xah Lee | last post by:
sometimes in the last few months, apparently Microsoft made changes to their JavaScript documentation website: ...
2
2275
by: robert | last post by:
When employing complex UI libs (wx, win32ui, ..) and other extension libs, nice "only Python stack traces" remain a myth. Currently I'm hunting again a rare C-level crash bug of a Python based...
1
2473
by: barb | last post by:
We are trying to build a multi level BOM report. The problem we are having is in designing the report so that the spacing for each level does not show up on the report when there is no information....
4
1495
by: Gilberto | last post by:
Hello, I have a report with some product information and i needed to create a NEW SORTING LEVEL with some TOTAL calculations which where located at the REPORT FOOTER, just so that they could be...
44
584
by: John Dann | last post by:
I'm unclear as to how best to use what I'm terming the top-level CSS selectors, by which I mean selectors like *, html and body. I'm coming at this from trying to understand how best to set font...
0
7136
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7018
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6906
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7397
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5490
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.