随笔分类 -  Mysql

mysql 截取字符串
摘要:建库:CREATE TABLE temp123 (val varchar(100));插数据:INSERT INTO temp123 VALUES ('123||http://localhost:9999/Upload/Images/ask/2011/7/29/129564046197968750.jpg||456');截取字符串 :SELECT CONCAT( SUBSTRING_INDEX(val, '||', 1),SUBSTRING_INDEX(val, '||', -1)) AS RESULT FROM temp123;结果:返回123 阅读全文
posted @ 2013-03-15 19:47 FanRongOS
查询数据库中like和 not in 一起使用
摘要:select * from Main where maistatus like '%1%' and maistatus not in (select maistatus from Main where maistatus like '%10%' or maistatus like '%11%'); 阅读全文
posted @ 2013-03-15 14:13 FanRongOS
excel导出时要导入其他对象的内容,可以再对象和配置文件中更改
摘要:cccc private String infotxt; private String resulttype; public String getResulttype() { return resulttype; } public void setResulttype(String resulttype) { this.resulttype = resulttype; } public String getInfotxt() { return infotxt; } public void s... 阅读全文
posted @ 2013-03-12 12:40 FanRongOS
Error Code: 1267. Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='0.001 sec
摘要:Mysql查询报错Error Code: 1267. Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='0.001 sec提示两个表的编码不一致,需要进行转换将比较等式一边进行字符串转换,如改为ALTER TABLE 表名 CONVERT TO CHARACTERSET utf8 collate utf8_unicode_ci 阅读全文
posted @ 2013-03-12 10:52 FanRongOS