abe= []
abibiti=1
self.cr.execute("SELECT name FROM account_analytic_account where parent_id=abibiti")
for t in self.cr.fetchall():
for item in t:
abe.append(item)
我想使用变量“abbiti”的值来检查 where 子句,谁能帮帮我
最佳答案
您在 cr.execute 中编写查询的方式存在一些问题。请将其更改为:
abe= []
abibiti=1
cr.execute("SELECT name FROM account_analytic_account where parent_id=%s"%(abibiti))
for t in cr.fetchall():
for item in t:
abe.append(item)
关于sql - openerp : using the value of a variable in where clause,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19635142/