小编use*_*679的帖子

SQL DELETE LEFT JOIN 查询

我的查询是:

DELETE p,p2,r 
FROM Profiles p
LEFT JOIN Pics p2 ON p.ID=p2.ProfileID
LEFT JOIN Food f ON p.ID=f.ProfileID
WHERE p.ID = 46
Run Code Online (Sandbox Code Playgroud)

该查询删除用户的个人资料、Pics 表中的所有图片以及食品表中所有匹配的 ProfileID。这将使我在 Profile 表中的 ID 为 47,48,在 Pics 表中的 ID 为 66,67,在 Food 表中的 ID 为 30,31,32,34

但我希望它也删除 Pics.ID ProfileID 为 46 的所有行,因此 Pics.ID 为 64 和 65。这两个 ID 要从 Food 表中删除。这将是 Food.ID 30 和 32 所以只剩下:食品表中的 ID 31, 34

配置文件表:

ID Gender
46 male
47 female
48 female
Run Code Online (Sandbox Code Playgroud)

图片表:

ID ProfileID Position
64 46        1 
65 …
Run Code Online (Sandbox Code Playgroud)

mysql sql left-join

1
推荐指数
1
解决办法
4118
查看次数

查找 GPS 坐标组之间的最短距离 - Python

例如这个 GPS 坐标数组:

GPSS = [{"Lat":40.641099,"Lon": -73.917094},{"Lat":40.60442,"Lon": -74.054873},{"Lat":40.779582,"Lon": -73.920213},{"Lat":40.651616,"Lon": -73.89097},{"Lat":40.755183,"Lon": -73.846248}]
Run Code Online (Sandbox Code Playgroud)

我已经计算了以下每种可能组合的距离:

Distances = [{'GPSS': [0, 1], 'Distance': 12.34895151892164}, {'GPSS': [0, 2], 'Distance': 15.380561959360797}, {'GPSS': [0, 3], 'Distance': 2.499303143635897}, {'GPSS': [0, 4], 'Distance': 14.012560598709298}, {'GPSS': [1, 2], 'Distance': 22.53687775052488}, {'GPSS': [1, 3], 'Distance': 14.824576927209662}, {'GPSS': [1, 4], 'Distance': 24.318038568441654}, {'GPSS': [2, 3], 'Distance': 14.423642658224264}, {'GPSS': [2, 4], 'Distance': 6.807346029310139}, {'GPSS': [3, 4], 'Distance': 12.106031672624894}]
Run Code Online (Sandbox Code Playgroud)

0,1 = 参考 40.641099,-73.917094 和 40.60442,-74.054873

1,4 = 40.641099,-73.917094 和 40.755183,-73.846248

我现在想找出访问每组坐标的最短距离(路线),因此很可能不是点 0 到 1 到 …

python arrays gps distance coordinates

-1
推荐指数
1
解决办法
5126
查看次数

标签 统计

arrays ×1

coordinates ×1

distance ×1

gps ×1

left-join ×1

mysql ×1

python ×1

sql ×1