changed sql back to sqlite3 syntax