Home > Database > Mysql Tutorial > mysql 多表连接查询实例

mysql 多表连接查询实例

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 09:57:10
Original
1255 people have browsed it

如下:两个表info,tag 

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

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

这样写就有问题: 

<code class="language-sql">select info.id, info.name from tag,info where info.name like ‘%'+tag.name+'%' </code>
Copy after login

 

正确: 

<code class="language-sql">select info.id, info.name from tag,info where info.name like concat( '%',tag.name, '%') </code>
Copy after login

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template