builder.AppendFormat($@"SELECT c.*,rbc.ClassName from rb_student as c
builder.AppendFormat($@"
SELECT c.*,rbc.ClassName
FROM rb_student as c
LEFT JOIN rb_student_orderguest as sog on sog.Student_Id=c.StuId
LEFT JOIN rb_class as rbc on rbc.ClassId=sog.ClassId
LEFT JOIN rb_class as rbc on rbc.ClassId=sog.ClassId
where sog.ClassId in(SELECT a.ClassId from rb_student_orderguest as a LEFT JOIN rb_class as b on a.ClassId=b.ClassId
LEFT JOIN rb_student as c on c.StuId =a.Student_Id
LEFT JOIN rb_order as o on a.OrderId=o.OrderId
...
...
@@ -164,14 +158,16 @@ where b.`Status`=0 and b.ClassStatus in(1,2) and a.status=0 and a.Account_Id={
{
varparameters=newDynamicParameters();
StringBuilderbuilder=newStringBuilder();
builder.AppendFormat($@"SELECT s.*,sog.GuestId,o.OrderState,cou.CourseName,cou.CourseId,c.ClassName,c.ClassId,c.ClassStatus,sch.SName,sch.SId,t.TeacherName,o.EnterID,(og.TotalHours-og.CompleteHours) as SurplusHours from rb_student as s LEFT JOIN rb_student_orderguest as sog on s.StuId=sog.Student_Id
LEFT JOIN rb_order_guest as og on og.Id=sog.GuestId
LEFT JOIN rb_order as o on og.OrderId=o.OrderId
LEFT JOIN rb_course as cou on o.CourseId=cou.CourseId
LEFT JOIN rb_class as c on c.ClassId=o.ClassId
LEFT JOIN rb_school as sch on sch.SId=c.School_Id
LEFT JOIN rb_teacher as t on t.TId=c.Teacher_Id
where o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 and cou.`Status`=0 and c.`Status`=0 and s.`Status`=0 and s.StuId={Student_Id} and s.Group_Id={Group_Id}");
builder.AppendFormat($@"
SELECT s.*,sog.GuestId,o.OrderState,cou.CourseName,cou.CourseId,c.ClassName,c.ClassId,c.ClassStatus,sch.SName,sch.SId,t.TeacherName,o.EnterID,(og.TotalHours-og.CompleteHours) as SurplusHours
FROM rb_student as s LEFT JOIN rb_student_orderguest as sog on s.StuId=sog.Student_Id
LEFT JOIN rb_order_guest as og on og.Id=sog.GuestId
LEFT JOIN rb_order as o on og.OrderId=o.OrderId
LEFT JOIN rb_course as cou on o.CourseId=cou.CourseId
LEFT JOIN rb_class as c on c.ClassId=o.ClassId
LEFT JOIN rb_school as sch on sch.SId=c.School_Id
LEFT JOIN rb_teacher as t on t.TId=c.Teacher_Id
WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 and cou.`Status`=0 and c.`Status`=0 and s.`Status`=0 and s.StuId={Student_Id} and s.Group_Id={Group_Id}");