select k.k_date, k.k_code, a.a_seq, a.a_date, a.a_code, sum(a.a_amount), a_amount
from k.Table1, a.Table2
where k.k_date = a.a_date
and k.k_code, a.a_code
and k.k_date = '20020928'
and k.k_code = '1001'
group by k.k_date, k.k_code, k.k_seq, a.a_date, a.a_code
k_date k_code a_aeq a_date a_code a_amount
----------------------------------------------------------------
20020928 1001 101 20020928 1001 10000
20020928 1001 102 20020928 1001 10000
이렇게 출력될려면..
k_date k_code a_seq a_date a_code a_amount
----------------------------------------------------------------
20020928 1001 101 102 20020928 1001 20000
~~~~~~
쿼리문... 조언 부탁드립니다..
sum부분과 From, Group By부분의 수정 입니다.
select k.k_date, k.k_code, a.a_seq, a.a_date, a.a_code, sum(a.a_amount) as a_amount
from Table1 k, Table2 a
where k.k_date = a.a_date
and k.k_code, a.a_code
and k.k_date = '20020928'
and k.k_code = '1001'
group by k.k_date, k.k_code, a.a_seq, a.a_date, a.a_code