Gentlemen,
I need to execute this Query:
SELECT COUNT(*) from
tabSales Invoice WHERE datevkonto IS NULL;
Using frappe.db.count() I tried these approaches which weren’t successful in creating the desired query:
frappe.db.count(“Sales Invoice”, filters={“datevkonto” : None}, debug=True)
frappe.db.count(“Sales Invoice”, filters={“datevkonto” : “”}, debug=True)
frappe.db.count(“Sales Invoice”, filters={“datevkonto” : “is null”}, debug=True)
frappe.db.count(“Sales Invoice”, filters={“datevkonto” : [“is”, “null”]}, debug=True)
select count(*)
from `tabSales Invoice` where `datevkonto` = NULL
Execution time: 0.0 sec
select count(*)
from `tabSales Invoice` where `datevkonto` = ''
Execution time: 0.0 sec
select count(*)
from `tabSales Invoice` where `datevkonto` = 'is null'
Execution time: 0.0 sec
select count(*)
from `tabSales Invoice` where `datevkonto` = 'null'
Execution time: 0.0 sec
Surely I could use frappe.db.sql() to execute my query, but I would like to know if there is a way to use frappe.db.count() for this.
By the way, I’m using frappe 13.22.1.