On Thu, 27 May 2010 12:45:58 -0700 Ethan Furman <et...@stoneleaf.us> wrote: > Let's say I have two tables: > > CatLovers DogLovers > ------------------- ------------------- > | name | age | | name | age | > |-----------------| |-----------------| [...] > > NumberOfPets > --------------------------- > | name | cats | dogs | > --------------------------- [...]
First problem is learning to count. :-) Second (first real) problem is that you database is not normalized. If all of the cat lovers and dog lovers are in NumberOfPets then move the age into that. Probably should rename it as well. Finally, are these SQL databases? The best way of getting information is with SQL. SELECT * FROM NumberOfPets WHERE name IN (SELECT name FROM CatLovers) OR name IN (SELECT name FROM DogLovers) ORDER BY name; > catlovers = dbf.Table('CatLovers') > doglovers = dbf.Table('DogLovers') > petcount = dbf.Table('NumberOfPets') I guess you should tell us what dbf is. It doesn't seem to be a standard module and it doesn't look like DB-API. It's hard to answer your question without knowing what these functions do. -- D'Arcy J.M. Cain <da...@druid.net> | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list