如何在 Django 中获取以下 SQL 查询集?
SELECT abbreviation, COUNT(tat_value) FROM t_tat
INNER JOIN t_tests ON t_tat.test_id = t_tests.test
GROUP BY test
这些是我的班级模型:
class tat(models.Model):
test = models.ForeignKey(tests)
tat_value
...
class tests(models.Model):
test = models.IntegerField(primary_key=True, default=0)
...