我在谷歌地图表中寻找重复项。问题是纬度略有不同,地址略有不同(但我可以说它们是重复的)。因此,我想得到纬度相同的所有记录,最多小数点后4位。怎么办呢?
类似的东西:
Select * from googlemap
having count(len latitude > 4) > 1
字段:
point_id
,entry_id
,latitude
,longitude
,address
,city
,zipcode
,state
,field_id
,icon
,supplier_id
第一个回答的示例数据:
'9', '51.5124', '9,557,885,908,964,1353,2145,2947'
'17', '32.7921', '17,19,94,2652'
'37', '32.7799', '37,101'
'54', '34.0953', '54,165'
'71', '42.3582', '71,2724'
'73', '25.7660', '73,125'
'100', '25.7906', '100,106'
'112', '25.7870', '112,378'
'113', '32.7114', '113,316'
'114', '25.7689', '114,140'
'129', '25.7708', '129,138,142'
'148', '25.7518', '148,155'
'156', '25.7710', '156,171'
'172', '35.6563', '172,175'
'174', '35.6559', '174,184'
'194', '48.8677', '194,261'
'195', '48.8661', '195,210,248,268'
答案 0 :(得分:2)
SELECT *
FROM googlemap g1
INNER JOIN googlemap g2
ON TRUNCATE(g1.latitude, 4) = TRUNCATE(g2.latitude, 4)
-- AND TRUNCATE(g1.longitude, 4) = TRUNCATE(g2.longitude, 4)
AND g1.point_id < g2.point_id
答案 1 :(得分:1)
这个怎么样?
SELECT ROUND(latitude,4), GROUP_CONCAT(point_id SEPARATOR ',')
FROM googlemap
GROUP BY ROUND(latitude,4)
HAVING COUNT(*) > 1