- 原本想說要把 location1 跟 location2 裡的資料切成 lat1, lng1, lat2, lng2,做好之後才發現原來國榮已經做了 maincase_new 的整理,因此接下來就先分析一下資料。
SELECT data_type.serial AS type_id, data_type.name AS
TYPE , maincase_new.owner_org, maincase_new.name, maincase_new.description, maincase_new.loc1_lon, maincase_new.loc1_lat, maincase_new.website, maincase_new.start_time
FROM data_type, maincase_new, maincase_detail
WHERE maincase_detail.maincase_id = maincase_new.serial
AND maincase_detail.type_id = data_type.serial
ORDER BY type_id, owner_org, loc1_lon, loc1_lat;
- 資料拓墣
SELECT DISTINCT data_type.serial AS type_id, data_type.parent_id, data_type.name AS
TYPE , maincase_new.owner_org
FROM data_type, maincase_new, maincase_detail
WHERE maincase_detail.maincase_id = maincase_new.serial
AND maincase_detail.type_id = data_type.serial
ORDER BY type_id, owner_org
- 現有資料經緯度範圍
SELECT max( loc1_lon ) , max( loc1_lat ) , max( loc2_lon ) , max( loc2_lat ) , min( loc1_lon ) , min( loc1_lat ) , min( loc2_lon ) , min( loc2_lat )
FROM maincase_new
WHERE loc1_lon >0 AND loc1_lat >0