如下sql我去到的dlsj没问题,但tcsj会变成9号我想取从3号到9号的每一天的最大时间和最小时间,该怎么实现 sql: SELECT TOP (10000000) [ryid] ,[ryxm] ,min([dlsj])as[dlsj] ,max([tcsj])[tcsj] FROM testS where [dlsj] between '2023-02-03' and '2023-02-09' --and dlsj group by ryid,ryxm order by dlsj desc 数据库数据如下: 数据集如下: SELECT [ryid] ,[ryxm] ,min([dlsj])as[dlsj] ,max([tcsj])[tcsj] FROM testA where dlsj is not null ${if(len(kssj)==0,""," and dlsj>='"+FORMAT(DATEDELTA(kssj,-1),"yyyy-MM-dd 20:30:00")+"'")} ${if(len(kssj)==0,""," and dlsj ${if(len(kssj)==0,""," and ReqTime<='"+FORMAT(kssj,"yyyy-MM-dd 20:30:00")+"'")} |