Change sql syntax for sqlite3