MySQL Forums
Forum List  »  Perl

lenght variables
Posted by: Willy Henkens
Date: October 22, 2010 02:56PM

Suppose a column :

12345 (grandfather)
123450 (grandmother)
123451 (grandfather's first child)
1234511 (grandfather's first grandchild from first child)
1234512 (grandfather's second grandchild from first child)
1234513 (grandfather's third grandchild from first child)
123452 (grandfather's second child)
1234521 (grandfather's first grandchild from second child)
1234522 (grandfather's second grandchild from second child)
and so on...
...
123456 (grandfather's sixth child)
1234561 (grandfather's first grandchild from sixth child)
and so on...
On their turn, every child or grandchild can be grandfather or grandmother in the future.

These numbers are selected as text (and not as number!), to enable sorting them in the way as they appear as such.

Question : when I have one value which is unique for 1 person in the ancestry, e.g. 125663 :
1) How can I select the record of the father, (having the number 12566), and the mother, (having the number 125660) ?
2) And further: how can Y select all the children 125661 , 125662, 125663 etc...having all 1 additional digit only and NOT the grandchildren having more digits?
In the event, on a given number, one need to search the number with one digit less and all the numbers having only one digit more.
Can somebody help me, please? Or advise me how to proceed ?

Options: ReplyQuote


Subject
Written By
Posted
lenght variables
October 22, 2010 02:56PM
October 22, 2010 04:37PM
October 24, 2010 02:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.