두 테이블의 고객 및 고객 주소가 있습니다. Join 기준은 CustomerNo 및 Date입니다. 날짜가 일치하지 않거나 고객 주소 테이블에 사용할 수없는 경우, 나는 고객 주소에서 최신 날짜날짜가 일치하지 않을 때 두 테이블 조인
Customer Table Customer Address Table CustomerNo Date CustomerNo Date Addr 123 1/1/2017 123 1/1/2017 sample1 123 2/1/2017 123 2/1/2017 sample2 123 2/11/2017 123 3/1/2017
예상 출력에 가입 할
Final Table CustomerNo Date Addr 123 1/1/2017 sample1 123 2/1/2017 sample2 122 2/11/2017 sample2 123 3/1/2017 sample2
때 날짜는 고객 주소에서 사용할 수 없으며 마지막 사용 가능 날짜와 일치합니다.
미리 감사드립니다.
UNION ALL을 (를) 사용해 볼 수도 있습니다. https://stackoverflow.com/a/34194725/8252554에서 그것에 대해 읽어 봅시다. – mtszpater