mysql 查询问题
时间:2011-11-14
来源:互联网
有表id_cotent
id content
1 <Font Face='宋体' Color='-16777216' Size='10'>你好 </Font>
2 宋代是人
3 宋朝灾星
4 woesldfjs
5 我地个身
sql:
select id ,content from id_content where content like '%宋%';
结果 id为1,2,3的记录都出来了,
希望结果:id为2,3的记录
问题:mysql有处理字符串的函数吗?比如过滤html的?
id content
1 <Font Face='宋体' Color='-16777216' Size='10'>你好 </Font>
2 宋代是人
3 宋朝灾星
4 woesldfjs
5 我地个身
sql:
select id ,content from id_content where content like '%宋%';
结果 id为1,2,3的记录都出来了,
希望结果:id为2,3的记录
问题:mysql有处理字符串的函数吗?比如过滤html的?
作者: shrimpma 发布时间: 2011-11-14
select id ,content from id_content where content like '宋%';
作者: DongAoYuan 发布时间: 2011-11-14
引用 1 楼 dongaoyuan 的回复:
select id ,content from id_content where content like '宋%';
一楼正解。 select id ,content from id_content where content like '宋%';
作者: ACMAIN_CHM 发布时间: 2011-11-14
引用楼主 shrimpma 的回复:
有表id_cotent
id content
1 <Font Face='宋体' Color='-16777216' Size='10'>你好 </Font>
2 中国宋代是人
3 宋朝灾星
4 woesldfjs
5 我地个身
sql:
select id ,content from id_content where content li……
有表id_cotent
id content
1 <Font Face='宋体' Color='-16777216' Size='10'>你好 </Font>
2 中国宋代是人
3 宋朝灾星
4 woesldfjs
5 我地个身
sql:
select id ,content from id_content where content li……
如果这样呢?
作者: shrimpma 发布时间: 2011-11-14
'%宋%' 这样模糊查询 **宋** 的都能出来 '宋%'这样出来的是 宋**
作者: DongAoYuan 发布时间: 2011-11-14
select id ,content from id_content where content like '宋%' and content not like '%</%';
感觉不太好控制 如果像这样写的话 如果内容里面有“</” 也都被过滤掉
感觉不太好控制 如果像这样写的话 如果内容里面有“</” 也都被过滤掉
引用 3 楼 shrimpma 的回复:
引用楼主 shrimpma 的回复:
有表id_cotent
id content
1 <Font Face='宋体' Color='-16777216' Size='10'>你好 </Font>
2 中国宋代是人
3 宋朝灾星
4 woesldfjs
5 我地个身
sql:
select id ,content from id_content where conte……
引用楼主 shrimpma 的回复:
有表id_cotent
id content
1 <Font Face='宋体' Color='-16777216' Size='10'>你好 </Font>
2 中国宋代是人
3 宋朝灾星
4 woesldfjs
5 我地个身
sql:
select id ,content from id_content where conte……
作者: DongAoYuan 发布时间: 2011-11-14
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28