두 개의 테이블이 있습니다. 표 "alldates"
은 날짜 열 "nextdate"
으로 구성됩니다. 표 "availability"
은 "availdate"
이라는 날짜 열을 포함하여 여러 열로 구성됩니다. "alldates"
테이블 기본 키는 열 "nextdate"
입니다. "availability"
테이블 기본 키는 "event_num"
이라는 열입니다. 설명을 목적으로두 SQL 테이블의 데이터를 병합하는 방법은 무엇입니까?
는의 테이블 "alldates"
16 행으로 채워집니다 가정 해 봅시다 10/01/2014 through 10/16/2014
날짜 및 테이블 "availability"
은과 같이, 9 행으로 채워집니다 :
Availdate Event_num Event Description
10/01/2014 3 Joe's birthday
10/04/2014 12 Bill's dentist appt
10/04/2014 5 Buy pizza
10/05/2014 6 Clean the house
10/07/2014 7 Go to theater
10/07/2014 8 Continue forward
10/09/2014 9 Mow the grass
10/11/2014 10 Take a nap
10/15/2014 11 Fix the clock
내가 다음과 같습니다 새 테이블을 작성해야합니다 :
Availdate Event_num Event Description
10/01/2014 3 Joe's birthday
10/02/2014 (from table "alldates")
10/03/2014 (from table "alldates")
10/04/2014 12 Bill's dentist appt
10/04/2014 5 Buy pizza
10/05/2014 6 Clean the house
10/06/2014 (from table "alldates")
10/07/2014 7 Go to theater
10/07/2014 8 Continue forward
10/08/2014 (from table "alldates")
10/09/2014 9 Mow the grass
10/10/2014 (from table "alldates")
10/11/2014 10 Take a nap
10/12/2014 (from table "alldates")
10/13/2014 (from table "alldates")
10/14/2014 (from table "alldates")
10/15/2014 11 Fix the clock
10/16/2014 (from table "alldates")