随笔分类 - sql
摘要:CREATE DEFINER=`root`@`%` FUNCTION `latlon`(lat1 DOUBLE,lon1 DOUBLE,lat2 DOUBLE,lon2 DOUBLE) RETURNS varchar(200) CHARSET utf8mb4 begin return ROUND( 6378.138 * 2 * ASIN( SQRT( ...
阅读全文
摘要:SELECT T2.id, T2.name FROM ( SELECT @r AS _id, @stop:=@stop+if(@r=2,1,@stop) as stop, (SELECT @r := p_id FROM goods_class WHERE id = _id) AS p_id, @l := @l + ...
阅读全文
摘要:SELECT count(status = 0 OR NULL) AS a, count(status = 1 OR NULL) AS b, count(status = 2 OR NULL) AS c, count(status = 3 OR NULL) AS d, count(status =
阅读全文
摘要:效果: oralce写法: select WM_CONCAT(A.title) as citys from tmpcity A sql server写法: select stuff((select ','+A.title from tmpCity A FOR xml PATH('')), 1, 1,
阅读全文