0
我有具有人的詳細信息表Data_Excel
:P_name,P_address,P_city
並具有ID,startdate,enddate
表Person
,我在Person_location
以下值ID,address,city,country,startdate,enddate
插入值,問題是,我要插入在person_location具有ID,StartDate
作爲主鍵我嘗試以下QUERY值但有一些結果如下:選擇不同的值,並插入到表中返回重複
SELECT Distinct A.ID,A.name,A.startdate,A.enddate,de.source,de.P_address,de.P_city,de.P_country
from data_excel de, person A
where A.name = de.P_name
and ID > 6566;
結果:
`7552 Adan George H. 30/12/1928 31/12/1928 Recueil Financier 1928 Avenue des Trois Couleurs 17 Woluwe-Saint-Pierre (Bruxelles)
7552 Adan George H. 30/12/1928 31/12/1928 Recueil Financier 1928 Avenue des Trois Couleurs 17 Woluwe-Saint-Pierre (Bruxelles) Belgie
Data_excel有多個輸入人名和地址,Id來自person表,我必須從person表比較名稱和data_excel中獲取id並獲取位置詳細信息,並最終在Person_location中插入id和位置表 –
那麼哪一排你想用插入和如何描述。最早的一個,最近的? –