if isSms: #Nokia changed the event number from 7 to 11 and also combined the incomming and outgoing sms's cur.execute("select count(id) from Events where event_type_id = 7 and outgoing = 0") else: #Nokia changed the event from 3 to 2 cur.execute("select count(id) from Events where event_type_id = 3 and outgoing = 0")