How do you make this sql into db.get_values?

How do you make something like this:

qty_prod_orders = frappe.db.sql('select sum(qty), parent, sales_order, IFNULL(fg_warehouse, "None"), IFNULL(wip_warehouse, "None") fromtabProduction Orderwhere docstatus = 1 group by sales_order, production_item')

into using frappe.db.get_values ? On that note is there any advantages of converting a frappe.db.sql to frappe.db.get_values ?

Just makes for better code readability. Its completely fine to use SQL (for reads) when you think it is most efficient.

1 Like

Thanks.