随笔分类 -  mysql

MySql某一列累计查询
摘要:问题:有一列数据,需要累计显示出来 比如:id salary 查询结果:id salary sumSalary 1 10000 1 10000 10000 2 20000 2 20000 30000 3 30000 3 30000 60000 解决方案 1、使用自定义变量 ①用 Set 定义变量 m 阅读全文
posted @ 2017-07-30 07:52 woqiaoxun 阅读(5781) 评论(0) 推荐(0)
mysql中的SUBSTRING_INDEX
摘要:SUBSTRING_INDEX(str,delim,count) Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everythi 阅读全文
posted @ 2016-11-18 10:16 woqiaoxun 阅读(197) 评论(0) 推荐(0)
mysql计划字段中有多少个逗号,或者某个标识符
摘要:eg:计划url中有多少个小数点 select length('www.mysql.com')-length(REPLACE('www.mysql.com','.','')); 阅读全文
posted @ 2016-11-18 10:15 woqiaoxun 阅读(1417) 评论(3) 推荐(1)
mysql中的游标使用案例
摘要:注意: 1.变量的定义不要和你的select的列的键同名!不然,fetch into 会失败! 2.变量定义顺序不对会报错 “Variable or condition declaration after cursor or handler declaration” 报错参见:http://stac 阅读全文
posted @ 2016-11-02 19:58 woqiaoxun 阅读(1488) 评论(0) 推荐(0)