随笔分类 -  mysql

摘要:1 DELIMITER | 2 drop procedure if exists pro_query; 3 CREATE PROCEDURE pro_query 4 ( 5 cname VARCHAR(50) 6 ) 7 BEGIN 8 9 #declare @sql varchar(1000) 10 11 SELECT * ,cname FROM... 阅读全文
posted @ 2017-06-13 16:49 苍洱 阅读(160) 评论(0) 推荐(0) 编辑
摘要:1 # 1 创建存储过程 2 /* 3 delimiter // 4 create procedure test() 5 begin 6 update test SET name = date_format(now(),'%Y-%c-%d %h:%i:%s'); 7 end; 8 */ 9 10 # 2 创建事件 调用存储过程 11 /* 12 create event i... 阅读全文
posted @ 2017-06-13 16:47 苍洱 阅读(121) 评论(0) 推荐(0) 编辑
摘要:1 创建存储过程 注:#的更新有问题,由于之前在C++中写sql的时候,字符串需要加‘’ 来确保是字符串。 2 调用存储过程 3结果 阅读全文
posted @ 2017-06-09 10:06 苍洱 阅读(302) 评论(0) 推荐(0) 编辑
摘要:问题描述: 在mysql中 user表中新增用户默认密码为123456,但是在数据库中显示不能为明文,而mysql的默认字段不能用函数 解决方法: 用触发器 delimiter | drop trigger if exists default_user_pwd;create trigger defa 阅读全文
posted @ 2017-06-08 11:33 苍洱 阅读(2758) 评论(0) 推荐(0) 编辑
摘要:lower_case_table_names=1 原来Linux下的MySQL默认是区分表名大小写的,通过如下设置,可以让MySQL不区分表名大小写:1、用root登录,修改 /usr/my.cnf;2、在[mysqld]节点下,加入一行: lower_case_table_names=13、重启M 阅读全文
posted @ 2017-05-31 16:07 苍洱 阅读(255) 评论(0) 推荐(0) 编辑
摘要:1 traceroleid表数据 tracerleid 表放着角色的相关信息, 角色ID 角色类型 密码 2 traceaccountmap表数据 表中存放着客户号和 其他角色的关系 traceroleid表中role字段 1 对应该表investConsultantID 2 对应表中invertM 阅读全文
posted @ 2017-05-25 18:45 苍洱 阅读(881) 评论(0) 推荐(0) 编辑
摘要:require ’socket‘ require ’luasql.mysql' 上述返回结果都是正常 但是执行 env = luasql.mysql(),报错: stdin:1: attempt to index a nil value (global 'luasql')stack tracebac 阅读全文
posted @ 2017-05-18 16:48 苍洱 阅读(11205) 评论(0) 推荐(0) 编辑
摘要:错误: require 'luasql.mysql'stdin:1: module 'luasql.mysql' not found: no field package.preload['luasql.mysql'] no file '/usr/local/share/lua/5.3/luasql/ 阅读全文
posted @ 2017-05-18 16:01 苍洱 阅读(4232) 评论(0) 推荐(1) 编辑
摘要:CREATE VIEW user_algo_view ASselect `u`.`userId` AS `UserId`,`u`.`userCode` AS `UserCode`,group_concat(`al`.`id` separator ',') AS `AlgoIdList`,group_ 阅读全文
posted @ 2017-05-09 09:51 苍洱 阅读(196) 评论(0) 推荐(0) 编辑
摘要:ErrorMsg:The user specified as a definer ('root'@'%') does not exist解决方法:权限问题,授权 给 root 所有sql 权限 mysql> grant all privileges on *.* to root@"%" identi 阅读全文
posted @ 2017-05-09 09:46 苍洱 阅读(270) 评论(0) 推荐(0) 编辑
摘要:From:http://www.cnblogs.com/joeblackzqq/p/4575938.html mysql错误代码对照表较完整 0101 属于其他进程的专用标志。 0102 标志已经设置,无法关闭。0103 无法再次设置该标志。0104 中断时无法请求专用标志。0105 此标志先前的所 阅读全文
posted @ 2017-05-04 08:45 苍洱 阅读(2389) 评论(0) 推荐(0) 编辑
摘要:DELETE u.*,acu.*,alu.* FROM user u, accountuser acu ,algouser alu WHERE u.userId=11 and acu.userID=11 and alu.userId=11 阅读全文
posted @ 2017-01-04 15:03 苍洱 阅读(370) 评论(0) 推荐(0) 编辑
摘要:create view user_account_view asSELECT u.userId UserId ,u.userCode UserCode,GROUP_CONCAT(ac.id) AccountIdList,GROUP_CONCAT(ac.accountCode) AccountCode 阅读全文
posted @ 2017-01-04 14:59 苍洱 阅读(186) 评论(0) 推荐(0) 编辑
摘要:将 countertype 整数类型转成字符串类型 SELECT counterType, CASE counterType WHEN 1 THEN 'CTP'WHEN 2 THEN 'NULL'WHEN 3 THEN '飞鼠'WHEN 4 THEN '飞鼠 FIX'WHEN 5 THEN 'CTP 阅读全文
posted @ 2017-01-04 14:50 苍洱 阅读(5638) 评论(0) 推荐(0) 编辑
摘要:insert into urls(company,counterType,mdUrl,tradeUrl) values('test', CASE 'test'WHEN 'CTP' THEN 1WHEN 'NULL' THEN 2WHEN '飞鼠' THEN 3WHEN '飞鼠 FIX' THEN 4 阅读全文
posted @ 2017-01-04 14:48 苍洱 阅读(1497) 评论(0) 推荐(0) 编辑
摘要:数据库表中id列不为自动增加,需要程序来增加id的SQL SELECTCASE IFNULL(MAX(id),1)WHEN 1 THEN 1ELSE MAX(id) + 1END AS newmaxidFROM test 阅读全文
posted @ 2017-01-04 14:35 苍洱 阅读(4430) 评论(0) 推荐(0) 编辑