SELECT a.KWAJUNG_AD_CLASS, 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.KWAJUNG_AD_CLASS = d.classCode WHERE ( ( a.ClassCode in ('A01002001','A01002002','A01003001', '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.kwajungname like '%연말정산%' or a.kwajungname like '%법인결산%' ) and ( a.kwajungname like '%광주%' ) and a.kwajung_code <> '1223' group by a.KWAJUNG_AD_CLASS, d.className, d.classorder order by d.classorder