Hi guys,
I’ve been having trouble figuring out how to apply the following. I want to query the database to count the number of entries containing a matching string. The string would be changing weekly. I’m using the code below
year = str(self.year)
week = str(self.week_number)
city = str(self.city)
name = str(year + “-” + week + “-” + city)
num = frappe.db.sql(“select count(name
) from tabaction_planning
where name like %s”, (name,))
If I substitute a string for name instead of using the variable the code does execute without a problem.
Thanks
I’ve tried different combinations of adding the wildcard symbol ‘%’ to ‘%s’ and or to ‘name’. But all have given errors so far