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)
我想使用变量“abibiti”的值来检查where子句,任何人都可以帮助我
答案 0 :(得分:2)
在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)