I want to execute the SQL query in the django code, but I don't know how to write the code and where to write the code...

SQL Query

SELECT submission_meterials_list.id, submission_meterials_list.material, SUM(reported_materials.kg) AS quantity 
FROM reported_materials,kw_report_submissions,submission_meterials_list 
WHERE reported_materials.submission_id=kw_report_submissions.id AND submission_meterials_list.id=reported_materials.material_id AND kw_report_submissions.requested_on >= '2019-04-21' AND kw_report_submissions.requested_on <='2019-04-27' 
GROUP BY submission_meterials_list.material

0 Answers