需求 按照开始时间和组号排序,仅显示时分
select
TRUNC("TB11B00"."BEGIN_DATE", 'MI') AS "BEGIN_MINUTE",
from TB11B00 t
where xxx
order by "BEGIN_MINUTE", "GROUP_NO", "GROUP_IX"
django code
service_orders.annotate(
begin_minute=Trunc('begin_date', 'minute', output_field=DateTimeField())
).order_by("begin_minute", "group_no", "group_ix")
trunc时间结果对比
网友评论