이렇게 조회한것처럼요
select 필드A, 필드B, 필드C from outd_1511
select x.icomcode as 코드
, sum((x.tmamoney1 - x.tbamoney1) - (x.cardvat1 + x.cardvat0)) as 필드A
from outd_1511 x, comp c
where x.icomcode = c.comcode
and x.day1 >= '2015-11-01' and x.day1 <= '2015-11-15'
group by x.icomcode, c.comname order by icomcode
select x.icomcode as 코드
, sum((x.tmamoney1 - x.tbamoney1) - (x.cardvat1 + x.cardvat0)) as 필드B
from outd_1511 x, comp c
where x.icomcode = c.comcode
and x.day1 >= '2015-11-01' and x.day1 <= '2015-11-15' and x.isvat='1'
group by x.icomcode, c.comname order by icomcode
select x.icomcode as 코드
, sum((x.tmamoney1 - x.tbamoney1) - (x.cardvat1 + x.cardvat0)) as 필드C
from outd_1511 x, comp c
where x.icomcode = c.comcode
and x.day1 >= '2015-11-01' and x.day1 <= '2015-11-15' and x.isvat='0'
group by x.icomcode, c.comname order by icomcode
|