Fork me on GitHub

随笔分类 -  数据库

摘要:测试数据表 以product_id;分组,把name字段的值打印在一行,逗号分隔(默认) SELECT id,GROUP_CONCAT(name) FROM test_brand GROUP BY product_id; 以id分组,把name字段的值打印在一行,分号分隔 SELECT id,GRO 阅读全文
posted @ 2018-08-10 15:22 何钊 阅读(497) 评论(0) 推荐(0)
摘要:UPDATE temp_ent_lyew t1,temp_ent_lyew t2 SET t1.latitude=t1.longitude,t2.longitude=t2.latitude where t1.latitude is not null and t1.longitude is not null and t2.latitude is not null and t2.longitude ... 阅读全文
posted @ 2017-08-18 20:36 何钊 阅读(739) 评论(0) 推荐(0)
摘要:--计算地球上两个坐标点(经度,纬度)之间距离sql函数 CREATE FUNCTION [dbo].[fnGetDistance](@LatBegin REAL, @LngBegin REAL, @LatEnd REAL, @LngEnd REAL) RETURNS FLOAT AS BEGIN --距离(千米) DECLARE @Distance REAL DECLARE @... 阅读全文
posted @ 2017-08-18 20:35 何钊 阅读(1126) 评论(0) 推荐(0)
摘要:--第一种 --第二种 --根据右上角经纬度和左下角经纬度查询范围内企业 阅读全文
posted @ 2017-08-18 20:34 何钊 阅读(1064) 评论(0) 推荐(0)