builder.AppendFormat(" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE 1=1 AND (CourseId=B.CourseId OR CourseId IN(SELECT CourseId FROM rb_order_course WHERE OrderId=A.OrderId)) AND CourseRate IN({0})) ",(int)query.QCourseRate);
stringchapterSql=string.Format(" SELECT DISTINCT CourseId FROM rb_course_chapter WHERE Status=0 AND CourseRate ={0} ",(int)query.QCourseRate);
builder.AppendFormat(@" AND (B.CourseId IN({0}) OR EXISTS (SELECT 1 FROM rb_order_course WHERE OrderId=A.OrderId AND CourseId IN({0}))) ",string.Join(",",courseIdList));
//builder.AppendFormat(" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE 1=1 AND (CourseId=B.CourseId OR CourseId IN(SELECT CourseId FROM rb_order_course WHERE OrderId=A.OrderId)) AND CourseRate IN({0})) ", (int)query.QCourseRate);
}
}
else
else
{
{
...
@@ -81,14 +88,7 @@ WHERE 1=1 AND B.OrderState=1 AND B.OrderType=1 AND E.ClassScrollType=2
...
@@ -81,14 +88,7 @@ WHERE 1=1 AND B.OrderState=1 AND B.OrderType=1 AND E.ClassScrollType=2
SELECT sog.Student_Id,sog.GuestId,sog.OrderId,cou.CourseName,s.StuName as GuestName,og.CourseChapterNo,sa.AppointNum,ss.MakeUpNum
SELECT sog.Student_Id,sog.GuestId,sog.OrderId,cou.CourseName,s.StuName as GuestName,og.CourseChapterNo,sa.AppointNum,ss.MakeUpNum
...
@@ -1036,7 +1044,8 @@ WHERE o.Group_Id ={group_Id} and sog.`Status` =0 and og.GuestState NOT IN(2) and
...
@@ -1036,7 +1044,8 @@ WHERE o.Group_Id ={group_Id} and sog.`Status` =0 and og.GuestState NOT IN(2) and
}
}
//sql += string.Format(@" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE Status=0 AND CourseId= o.CourseId AND ParentId =0 AND CourseRate ={0})", CourseGradeId);
//sql += string.Format(@" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE Status=0 AND CourseId= o.CourseId AND ParentId =0 AND CourseRate ={0})", CourseGradeId);
sql+=string.Format(@" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE Status=0 AND (CourseId= o.CourseId OR CourseId IN(SELECT CourseId FROM rb_order_course WHERE OrderId=sog.OrderId)) AND CourseRate ={0})",CourseGradeId);
//sql += string.Format(@" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE Status=0 AND (CourseId= o.CourseId OR CourseId IN(SELECT CourseId FROM rb_order_course WHERE OrderId=sog.OrderId)) AND CourseRate ={0})", CourseGradeId);
sql+=string.Format(@" AND (o.CourseId IN({0}) OR EXISTS (SELECT 1 FROM rb_order_course WHERE OrderId=sog.OrderId AND CourseId IN({0}))) ",string.Join(",",courseIdList));