2014-01-08 32 views
-1

當Access執行ORDER BY時,我在cooltable.distance上收到輸入參數值,這很奇怪,因爲距離是在cooltable中創建的列。我錯過了什麼?在sql中輸入參數值

SELECT 
target_postcodes.target_postcode, 
population_postcodes.population_postcode, 
cooltable.distance, 
SQR((Population_postcodes.Longitude - target_postcodes.longitude)^2 + (Population_postcodes.Latitude - target_postcodes.latitude)^2) as distance 

INTO 
cooltable 

FROM 
Population_postcodes, 
Target_postcodes 


ORDER BY 
cooltable.distance; 
+0

它看起來像你想它已經與'into'語句創建之前從'cooltable'檢索數據。如果它已經存在,你可能想使用'insert'而不是'select ... into' – jpw

+0

這就是我的想法。有關如何修復它的任何建議?可能以某種方式嵌套它? –

+2

是不是在你的2張桌子上缺少連接? –

回答

0
INSERT INTO CoolTable(col1, col2, col3) 
SELECT ..... 
FROM ... 
WHERE ... 
+0

不工作,也許是因爲即時通訊使用MS訪問? –

+0

錯誤是什麼? –

+0

查詢值和目標字段的數量不一樣 –