8개의 테이블을 병합하고자 합니다.
1. TDADept
-------------------------------------------------------------------------------------------------------------------
DepCd DepNm
-------------------------------------------------------------------------------------------------------------------
0001 서울업무1부
0002 부산업무1부
-------------------------------------------------------------------------------------------------------------------
2. TDAAccUnit
-------------------------------------------------------------------------------------------------------------------
AccUnit AccUnitNm
-------------------------------------------------------------------------------------------------------------------
0001 서울사무소
0002 부산사무소
-------------------------------------------------------------------------------------------------------------------
3. TDAEmpMaster
-------------------------------------------------------------------------------------------------------------------
EmpIdt EmpNm
-------------------------------------------------------------------------------------------------------------------
0356 홍길동
0357 이순신
-------------------------------------------------------------------------------------------------------------------
4. TDACustMaster
-------------------------------------------------------------------------------------------------------------------
CustCd CustNm
-------------------------------------------------------------------------------------------------------------------
0001 삼성전자
0002 엘지전자
-------------------------------------------------------------------------------------------------------------------
5. TSSBillM
-------------------------------------------------------------------------------------------------------------------------------------------------
Billno Billdate AccUnit CustCd DeptCd EmpId
-------------------------------------------------------------------------------------------------------------------------------------------------
0001 2016-12-01 0001 0001 0001 0356
0002 2016-12-02 0001 0001 0002 0357
-------------------------------------------------------------------------------------------------------------------------------------------------
6. TSSBillItem
---------------------------------------------------------------------------------------------------------------------------------------------------------
BillNo AccUnit CustCd DeptCd EmpId Amt vat
---------------------------------------------------------------------------------------------------------------------------------------------------------
0001 0001 0001 0001 0356 5,000,000 500,000
0002 0002 0002 0002 0357 4,000,000 400,000
--------------------------------------------------------------------------------------------------------------------------------------------------------
7. TSSReceiptM
-------------------------------------------------------------------------------------------------------------------------------------------------
Receiptno ReceiptDate AccUnit CustCd DeptCd EmpId
-------------------------------------------------------------------------------------------------------------------------------------------------
0001 2016-12-30 0001 0001 0001 0356
0002 2016-12-31 0001 0002 0002 0357
-------------------------------------------------------------------------------------------------------------------------------------------------
8. TSSReceiptDesc
--------------------------------------------------------------------------------------------------------------------------------------------
ReceiptNo AccUnit CustCd DeptCd EmpId Amt
--------------------------------------------------------------------------------------------------------------------------------------------
0001 삼성전자 0001 0001 0356 5,500,000
0002 엘지전자 0001 0001 0357 4,400,000
--------------------------------------------------------------------------------------------------------------------------------------------
위의 8개의 테이블을 아래와 같이 병합하여야 합니다.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
date AccUnit AccUnitNm CustCd CustNm DeptCd DeptNm EmpId EmpNm Amt 구분
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2016-12-01 0001 서울사무소 0001 삼성전자 0001 서울업무1부 0356 홍길동 5,000,000 판매
2016-12-02 0002 부산사무소 0002 엘지전자 0002 부산업무1부 0357 이순신 4,000,000 판매
2016-12-30 0001 서울사무소 0001 삼성전자 0001 서울업무1부 0356 홍길동 5,500,000 수금
2016-12-31 0002 부산사무소 0002 엘지전자 0002 부산업무1부 0357 이순신 4,400,000 수금
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
답변 부탁합니다.
Comment 1
-
처리짱
2017.01.31 17:25
마지막 결과물 나오는 곳의 첫번째 컬럼에 있는 테이블부터
순서대로 LEFT JOIN으로 걸어나가면 되지 싶네요..