SELECT s.StuName,sog.Student_Id AS StuId,sog.OrderId,sog.GuestId,o.CourseId,IFNULL(oc.OrderCourseIds,'') AS OrderCourseIds,IFNULL(sps.ShowRetes,'') AS ShowRetes
SELECT s.StuName,sog.Student_Id AS StuId,sog.OrderId,sog.GuestId,o.CourseId,IFNULL(oc.OrderCourseIds,'') AS OrderCourseIds,IFNULL(sps.ShowRetes,'') AS ShowRetes,IFNULL(sps.Id,0) AS PlanShowId
FROM rb_student_orderguest AS sog LEFT JOIN rb_order_guest AS og ON sog.GuestId=og.Id
LEFT JOIN rb_order AS O ON sog.OrderId=o.OrderId
LEFT JOIN rb_student AS s ON sog.Student_Id=s.StuId
LEFT JOIN (SELECT OrderId,GROUP_CONCAT(CourseId) AS OrderCourseIds FROM rb_order_course GROUP BY OrderId) AS oc ON sog.OrderId=oc.OrderId
LEFT JOIN rb_class AS E ON O.ClassId=E.ClassId
LEFT JOIN rb_scroll_planshow AS sps ON sog.Student_Id=sps.StuId AND sog.GuestId=sps.OrderId AND sog.GuestId=sps.GuestId and sps.Status=0
LEFT JOIN rb_scroll_planshow AS sps ON sog.Student_Id=sps.StuId AND sog.OrderId=sps.OrderId AND sog.GuestId=sps.GuestId and sps.Status=0
WHERE 1=1 AND O.OrderState=1 AND O.OrderType=1 AND E.ClassScrollType=2
");
if(query!=null)
...
...
@@ -183,7 +186,8 @@ WHERE 1=1 AND O.OrderState=1 AND O.OrderType=1 AND E.ClassScrollType=2