SQL 写法:
SELECT MIN(max_salary),did
FROM
(SELECT MAX(salary) AS max_salary,e.`department_id` did
FROM employees e
GROUP BY e.`department_id`)AS tmp
另外,SQLAlchemy 可以使用 alias()
,请问 Django 如何实现这种写法?
1
yonng 2022-01-12 09:56:31 +08:00
|
3
IurNusRay 2022-01-12 10:09:53 +08:00
不是在后面接上 filter 就可以了吗
queryset1 = A.objects.filter() queryset2 = queryset1.filter() |