当前位置:数据库 > MySQL >>

mysql中的concat用法!

请问; concat(goods_sn,goods_title,goods_brief,goods_name) LIKE '%tablet%' 这个是什么意思呢?
追问:是这些字段的值组合在一起,然后 like '%tablet%';
还是
goods_sn like '%tablet%' or goods_title like '%tablet%' or goods_brief like '%tablet%' or goods_name like '%tablet%'就是这些字段的值组合后的like 模糊搜索匹配,是么?
答案:concat 等同于字符串连接符 ||, 

你的等价于
concat(goods_sn,goods_title,goods_brief,goods_name) LIKE '%tablet%'

goods_sn||goods_title||goods_brief||goods_name LIKE '%tablet%
其他:举个例子  select concat('aa','bb');------------最终显示的就是 aabb,同时,concat有 to_char的作用,就是把其他类型转成varchar类型的 

上一个:mysql中的 insert into select 问题,想在同个服务器下复制不同数据库的表的内容,在线求方法,谢谢
下一个:使用mysql中,我想把表product的数据备份到同个服务器创建一个新表出来,刚学习mysql,用SELECT INTO 出错

Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,