From 6016871883aeb5fb136f9deb842dbd721251206e Mon Sep 17 00:00:00 2001 From: naath Date: Sun, 6 Apr 2014 13:06:51 +0100 Subject: [PATCH] list age at birth of children --- familyTree/askQuestion.py | 13 +++++++++++++ familyTree/notes | 2 ++ familyTree/printLists.py | 14 ++++++++------ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/familyTree/askQuestion.py b/familyTree/askQuestion.py index dfa1fc7..f5cfa24 100755 --- a/familyTree/askQuestion.py +++ b/familyTree/askQuestion.py @@ -257,6 +257,19 @@ def count_death_month(newLine): return out +def count_age_at_child(newLine): + + s = "select p1.bornYear - p2.bornYear as age, count(*)"\ + +" FROM"\ + +" parents INNER JOIN people p1"\ + +" ON parents.ID = p1.ID"\ + +" INNER JOIN people p2"\ + +" ON parents.parentID = p2.ID"\ + +" WHERE p1.bornYear <> 0 and p2.bornYear<>0"\ + +" GROUP BY age;" + + out = print_query(s,(),newLine) + return out def all_ancestors(personID,newLine): #find parents diff --git a/familyTree/notes b/familyTree/notes index eb163ad..014f328 100644 --- a/familyTree/notes +++ b/familyTree/notes @@ -5,3 +5,5 @@ ./makeTables.py | sqlite3 tree.db Deal with Consorts, this means including DATES OF MARRIAGE AND DIVORCE + +ELEANOR OF CASTILE has the WRONG PARENTS!!!! diff --git a/familyTree/printLists.py b/familyTree/printLists.py index 808164c..f0810f0 100755 --- a/familyTree/printLists.py +++ b/familyTree/printLists.py @@ -11,18 +11,20 @@ conn = askQuestion.connect() #print o -o = askQuestion.count_birth_month('\n') -print o +#o = askQuestion.count_birth_month('\n') +#print o -o = askQuestion.count_death_month('\n') -print o +#o = askQuestion.count_death_month('\n') +#print o #o = askQuestion.list_territories('\n') #print o -o = askQuestion.list_people('\n') -print o +#o = askQuestion.list_people('\n') +#print o +o = askQuestion.count_age_at_child('\n') +print o askQuestion.close(conn) -- 2.30.2