d전표상세품목 조건에 해당되는 not in ('1116') icomcode 가 포함된 m전표를 빼고 싶어요
select m.* from outm_1501 m inner join outd_1501 d on m.junno=d.junno
where d.icomcode not in ('1116')
group by m.junno, m.day1, d.icomcode
m전표
날짜 전표번호
2015-01-16 2015-01-1610005
2015-01-16 2015-01-1610006
d전표상세품목
날짜 전표번호 icomcode
2015-01-16 2015-01-1610005 4545
2015-01-16 2015-01-1610005 1116
2015-01-16 2015-01-1610006 7800
|