SELECT a.classCode, d.className FROM TBL_KWAJUNG a left JOIN TBL_KISU b on b.kwajung_code = a.kwajung_code left JOIN TBL_CHASI c ON c.kwajung_code = a.kwajung_code AND (c.kisu_code = b.kisu_num or c.kisu_code = b.kisu_code) left JOIN TBL_CLASS_NEW d on a.classCode = d.classCode WHERE ( ( a.ClassCode in ('A01001001','A01001003') and c.chasi_status <> '3' AND ( left(c.start_date,6) >= replace(convert(varchar(7),getdate(),102),'.','') and left(c.start_date,6) <= replace(convert(varchar(7),dateadd(M,3,getdate()),102),'.','') ) And c.end_date > replace(convert(varchar(10),getdate(),102),'.','') ) or ( a.kwajung_code in ('815','883','1121','1098','887','888') AND ( left(c.start_date,6) >= replace(convert(varchar(7),getdate(),102),'.','') and left(c.start_date,6) <= replace(convert(varchar(7),dateadd(M,3,getdate()),102),'.','') ) And c.end_date > replace(convert(varchar(10),getdate(),102),'.','') ) ) and a.kwajung_code <> '1223' group by a.classCode, d.className
실무이론과정