query and conversion completed

better query for summary page
okay i will do as u said i wanted all the queries to be in sqldb.py.