trying sqlite for loops again