![](/img/trans.png)
[英](psycopg2.errors.UndefinedColumn) column "name" does not exist
[英]Psycopg2.errors.Undifinedcolumn : column does not exist
我想在 python 上使用 where 但它說該列不存在。 我實際上有特定的列
name1 = input("Enter the
name"
query = 'select * from
"Job" where name =
{0}.format(name1)
cur.execute(query)
我猜您有問題,因為您沒有在name1
周圍使用引號。 因此name1
值被視為列名而不是過濾條件。
這應該做的工作:
name1 = input("Enter the name : ")
query = f'select * from "Job" where name = \'{name1}\''
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.