您好,欢迎来到锐游网。
搜索
您的当前位置:首页mysql多表连接查询实例

mysql多表连接查询实例

来源:锐游网

如下:两个表info,tag

info 表
id name
1 aa和bb
2 bb和cc
3 ee和dd

tag表
1 aa
2 bb
tag表中 name 匹配 info 中的name

这样写就有问题:

select info.id, info.name from tag,info where info.name like ‘%'+tag.name+'%' 

正确:

select info.id, info.name from tag,info where info.name like concat( '%',tag.name, '%') 

Copyright © 2019- ryyc.cn 版权所有

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务