0
需要使用Tereadata我需要拉該聯接許多表報告一些幫助......這裏是基本概念:合併來自多個表中的數據與特定的數據報表
Select Table1.ID, Table2.Arrival_date, Table2.Name
From Table1
Inner Join Table1.ID on Table2.ID
Where table2.arrival_date between '10/01/2013' and '10/02/2013'
然後是包括另一個表以下信息
ID Item Cost Date
1 Flour 1.99 10/02/2013
2 cheese 3.99 10/01/2013
3 Flour 1.99 8/16/2013
我想要將它添加到上表
Select Itemtable.ID, Itemtable.item, itemtable.cost, itemtable.date
from itemtable
where itemtable.date between '10/01/2013' and 10/02/2013
and itemtable.item like '%flour%'
Itemtable.ID = Table1.ID - 但是當我進行加入時,我只得到那些買了麪粉的客戶 - 我希望在該日期框架之間看到所有客戶,如果他們買了麪粉,我希望它 - 我的最終桌子看起來像這個:
ID Arrival Date Name ID Item Cost Date
1 10/01/2013 Dan
2 10/01/2013 Mike
3 10/01/2013 Nancy
1 10/02/2013 Dan 1 Flour 1.99 10/02/2013
5 10/02/2013 Mary
任何幫助,將不勝感激!
請給我們你的表及其關聯的名稱。提前致謝 ! – Christos