values = {‘company’: ‘Frappe Technologies Inc’}
data = frappe.db.sql(“”"
SELECT
acc.account_number
gl.debit
gl.credit
FROM tabGL Entry
gl
LEFT JOIN tabAccount
acc
ON gl.account = acc.name
WHERE gl.company = %(company)s
“”", values=values, as_dict=0)
In this example of frappe.db.sql how to pass multiple values in values??
spryng
2
I will do it this way:
values=“AND time BETWEEN '” + date_from_filter + “’ AND '” + date_to_filter + “'”
not working??
i want to pass multiple values in one filter only in script report?
in this example as i pass only one value “Frappe Technologies Inc” instead of this i want to pass two value.
values = {
‘company’: [‘Frappe Technologies Inc’, 'Second Company']
}
data = frappe.db.sql("""
SELECT
acc.account_number
gl.debit
gl.credit
FROM `tabGL Entry` gl
LEFT JOIN `tabAccount` acc
ON gl.account = acc.name
WHERE gl.company IN %(company)s
“”", values=values, as_dict=0)
Untested, but this should work.
Also, switch to frappe.qb and avoid raw SQL.
https://frappeframework.com/docs/v13/user/en/api/query-builder