stringsql=$@"SELECT f.*,f1.Remark,f1.CreateTime FROM
(SELECT StuId,AssistType,DATE_FORMAT(CreateTime,'%Y-%m') as MonthStr,MAX(Id) AS Id FROM rb_student_follow WHERE Group_Id ={group_Id} and `Status` =0 and StuId in ({stuIds}) and AssistType in(2,4)
stringsql=$@"
SELECT f.*,f1.Remark,f1.CreateTime
FROM
(
SELECT StuId,AssistType,DATE_FORMAT(CreateTime,'%Y-%m') as MonthStr,MAX(Id) AS Id
FROM rb_student_follow
WHERE Group_Id ={group_Id} and `Status` =0 and StuId in ({stuIds}) AND AssistType in(2,4)
GROUP BY StuId,AssistType,DATE_FORMAT(CreateTime,'%Y-%m')
) f
INNER JOIN rb_student_follow f1 on f.Id = f1.Id
...
...
@@ -112,11 +117,13 @@ INNER JOIN rb_student_follow f1 on f.Id = f1.Id
stringsql=$@"SELECT s.StuId,DATE_FORMAT(o.CreateTime,'%Y-%m') AS MonthStr FROM rb_student s
INNER JOIN rb_student_orderguest sog on s.StuId = sog.Student_Id
INNER JOIN rb_order o on sog.OrderId = o.OrderId
INNER JOIN rb_order_guest og on og.Id = sog.GuestId
where s.Group_Id ={group_Id} and s.`Status` =0 and sog.`Status` =0 and o.OrderState <>3 and (o.RenewOrderId >0 or og.RenewState =2) and s.StuId in({stuIds})
stringsql=$@"
SELECT s.StuId,DATE_FORMAT(o.CreateTime,'%Y-%m') AS MonthStr
FROM rb_student s
INNER JOIN rb_student_orderguest sog on s.StuId = sog.Student_Id
INNER JOIN rb_order o on sog.OrderId = o.OrderId
INNER JOIN rb_order_guest og on og.Id = sog.GuestId
WHERE s.Group_Id ={group_Id} and s.`Status` =0 and sog.`Status` =0 and o.OrderState <>3 and (o.RenewOrderId >0 or og.RenewState =2) and s.StuId in({stuIds})
GROUP BY s.StuId,DATE_FORMAT(o.CreateTime,'%Y-%m')