chiark / gitweb /
list age at birth of children
authornaath <naath@chiark.greenend.org.uk>
Sun, 6 Apr 2014 12:06:51 +0000 (13:06 +0100)
committernaath <naath@chiark.greenend.org.uk>
Sun, 6 Apr 2014 12:06:51 +0000 (13:06 +0100)
familyTree/askQuestion.py
familyTree/notes
familyTree/printLists.py

index dfa1fc71fbb53906e984d2d0e6f7b0ee1f47e008..f5cfa244551164a44f69d6fcb43f45fcb4332fda 100755 (executable)
@@ -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
index eb163adfacc2870a8a9890105eb140d8a5d3af35..014f328125519429f959f2feeb9b904b3d012757 100644 (file)
@@ -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!!!!
index 808164c3f77491eb03bc7c24ee46cfc8765599af..f0810f09d7d328031c07838e0b922aeb6946db35 100755 (executable)
@@ -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)