Update高难问题又来了。!!(跟上次差不多!)
为了更新方便及速度,现在将表poibaseinfo(无索引)复制一个为t_temp表(有索引) ,然后从t_temp读取,后再更新poibaseinfo中的内容。
poibaseinfo表
nid strcitycode strinfotype strname strTransferTation dlatitude dlongitude
------------------------------------------------------------------------------------------
679411 010 G12 草桥欣园 39.83933900 116.38038800
679411 010 G12 菊园 39.8393000 116.38030000
要求将更新数据库中每条记录的 strTransferTation 字段,条件是dlatitude(经度) dlongitude(纬度)此记录为100米范围内strname的记录名称的记录找出然后写入 strTransferTation .
查找100米范围的语句给出:
以查找 草桥欣园 的100米内记录为例:
select * from t_temp where (ABS(39.83933900 - dlongitude)+ABS(116.38038800- dlatitude))<=0.001
要求最后结果橡这样:
nid strcitycode strinfotype strname strTransferTation dlatitude dlongitude
------------------------------------------------------------------------------------------
679411 010 G12 草桥欣园 草桥欣园 菊园 39.83933900 116.38038800
679411 010 G12 菊园 草桥欣园 菊园 39.8393000 116.38030000