join rb_class_plan d on c.ClassPlanId = d.ClassPlanId
// from rb_class_time c left
// join rb_class_plan d on c.ClassPlanId = d.ClassPlanId
where d.ClassDate < b.ClassDate and c.ClassId = b.ClassId)
from rb_class_plan b where b.ClassPlanId = "+planId+" and b.`Status`= 0";
// where d.ClassDate < b.ClassDate and c.ClassId = b.ClassId)
//from rb_class_plan b where b.ClassPlanId = " + planId + " and b.`Status`= 0";
stringsql="select (select Count(0) from rb_class_plan b where b.ClassId=a.ClassId and b.ClassDate<a.ClassDate) from rb_class_plan a where ClassPlanId="+planId+" and `Status`=0";
builder.AppendFormat(" AND ({0}='{1}' or {2} like '{3}.%')",nameof(RB_Course_Chapter_ViewModel.ChapterNo),currentHours,nameof(RB_Course_Chapter_ViewModel.ChapterNo),currentHours);
//builder.AppendFormat(" ORDER BY {0} Desc",nameof(RB_Course_Chapter_ViewModel.CurrentHours));