//CONCAT(substring(C.ClassDate,1,10),' ',C.ClassTime,':00') AS StartTime,CONCAT(substring(C.ClassDate,1,10),' ',C.EndTime,':00') AS EndTime
builder.AppendFormat(@"
SELECT 1
FROM RB_Reserve_Class c
WHERE 1=1 AND c.Status=0 AND NOT(CONCAT(substring(C.ClassDate,1,10),' ',C.ClassTime,':00')> '{0}' or CONCAT(substring(C.ClassDate,1,10),' ',C.EndTime,':00')< '{1}')
",endTime,startTime);
if(query.TeacherId>0)
{
builder.AppendFormat(" AND C.TeacherId={0} ",query.TeacherId);
}
if(query.ReserveClassId>0)
{
builder.AppendFormat(" AND C.ReserveClassId<>{0} ",query.ReserveClassId);