[optimize] remove count(*) from queries

This commit is contained in:
Rushabh Mehta
2016-11-21 14:57:36 +05:30
parent 8042aa4b52
commit 5a258cbc2d
6 changed files with 11 additions and 11 deletions

View File

@@ -18,6 +18,6 @@ def execute():
frappe.db.sql("""update `tabEmployee` set user_id=null
where user_id=%s and name!=%s""", (user_id, employee))
else:
count = frappe.db.sql("""select count(*) from `tabEmployee` where user_id=%s""", user_id)[0][0]
count = frappe.db.sql("""select count(name) from `tabEmployee` where user_id=%s""", user_id)[0][0]
frappe.db.sql("""update `tabEmployee` set user_id=null
where user_id=%s limit %s""", (user_id, count - 1))