combine sqlite statements for efficiency