简体   繁体   中英

sqlite3.OperationalError: no such column: USA

I am moving data from one database to another with the following statment

    cursor.execute("\
                INSERT INTO table (ID, Country)\
                SELECT ID, Country\
                FROM database.t\
                WHERE Country = `USA`\
                GROUP BY Country\
                ;")

But I get the error

    sqlite3.OperationalError: no such column: USA

Can't figure out why

Use single quotes, not backticks, when referring to a string literal in your SQLite query:

INSERT INTO table (ID, Country)
SELECT ID, Country
FROM database.t
WHERE Country = 'USA'
GROUP BY Country

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM