Hi Guys ,
I created a query report where I wanted to find the days elapsed between two given dates , the following query returns an error, could you guys help me with this ?
DATEDIFF(day,'CURDATE()','po_date') as "No of days"
Traceback (most recent call last):
File "/home/ommi/frappe-bench/apps/frappe/frappe/app.py", line 55, in application
response = frappe.handler.handle()
File "/home/ommi/frappe-bench/apps/frappe/frappe/handler.py", line 19, in handle
execute_cmd(cmd)
File "/home/ommi/frappe-bench/apps/frappe/frappe/handler.py", line 36, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File "/home/ommi/frappe-bench/apps/frappe/frappe/__init__.py", line 876, in call
return fn(*args, **newargs)
File "/home/ommi/frappe-bench/apps/frappe/frappe/desk/query_report.py", line 82, in run
result = [list(t) for t in frappe.db.sql(report.query, filters)]
File "/home/ommi/frappe-bench/apps/frappe/frappe/database.py", line 137, in sql
self._cursor.execute(query, values)
File "/home/ommi/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/home/ommi/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1582, "Incorrect parameter count in the call to native function 'DATEDIFF'")
Thanks