我需要幫助查詢兩條表成爲表加入表 - 行至
第一個表,Tbl_Project:
|No_Project | Date_Start| Date_End |
|---------------|---------- |-----------|
|050/1/2015 | 20150105| 20150315 |
|051/2/2015 | 20150205| 20150515 |
|052/3/2015 | 20150305| 20150715 |
|053/4/2015 | 20150405| 20150915 |
第二個表,Tbl_DimDate:
| Date | Year | Month| Day | Tanggal_Id | Weekth |Month_Name |
| -----------| ------| ------| ------| -----------| ------ |-----------|
| 2015-01-05 | 2015 | 1| 5 | 20150105| 2 | Jan |
| 2015-02-05 | 2015 | 2| 5 | 20150205| 6 | Feb |
| 2015-03-05 | 2015 | 3| 5 | 20150305| 10 | Mar |
| 2015-04-05 | 2015 | 4| 5 | 20150405| 15 | Apr |
| 2015-03-15 | 2015 | 3| 15 | 20150315| 12 | Mar |
| 2015-05-15 | 2015 | 5| 15 | 20150515| 20 | May |
| 2015-07-15 | 2015 | 7| 15 | 20150715| 29 | Jul |
| 2015-09-15 | 2015 | 9| 15 | 20150915| 38 | Sept |
如何使連接表看起來像這樣:
|No_Project | Date_Start| Date_End | Week_Start | Week_End |
|-----------|---------- |-----------|------------|----------|
|050/1/2015 | 20150105| 20150315 | 2 | 12 |
|051/2/2015 | 20150205| 20150515 | 6 | 20 |
|052/3/2015 | 20150305| 20150715 | 10 | 29 |
|053/4/2015 | 20150405| 20150915 | 15 | 38 |
可能的複製[SQL JOIN和不同類型的連接(http://stackoverflow.com/questions/17946221/sql-join-and - 不同類型的連接) – MikaelF