如何在代码中使用MySQL查询,以便我们可以在网页中获取数据

时间:2019-05-06 06:09:43

标签: django-models

我想在Django代码中执行SQL查询,但是我不知道如何编写代码以及在哪里编写代码...

SQL查询

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 个答案:

没有答案