Home > php教程 > PHP源码 > INNER JOIN SQL statement to connect two tables, three tables, or five tables

INNER JOIN SQL statement to connect two tables, three tables, or five tables

WBOY
Release: 2016-07-11 08:44:05
Original
2264 people have browsed it
Jump to [1] [Full screen preview]
SQL INNER JOIN关键字表示在表中存在至少一个匹配时,INNER JOIN 关键字返回行。

1、连接两个数据表的用法:

FROM Member INNER JOIN MemberSort ON Member.MemberSort=MemberSort.MemberSort

语法格式可以概括为:

FROM 表1 INNER JOIN 表2 ON 表1.字段号=表2.字段号

2、连接三个数据表的用法:

FROM (Member INNER JOIN MemberSort ON Member.MemberSort=MemberSort.MemberSort) INNER JOIN MemberLevel ON Member.MemberLevel=MemberLevel.MemberLevel

语法格式可以概括为:

FROM (表1 INNER JOIN 表2 ON 表1.字段号=表2.字段号) INNER JOIN 表3 ON 表1.字段号=表3.字段号

3、连接四个数据表的用法:

FROM ((Member INNER JOIN MemberSort ON Member.MemberSort=MemberSort.MemberSort) INNER JOIN MemberLevel ON Member.MemberLevel=MemberLevel.MemberLevel) INNER JOIN MemberIdentity ON Member.MemberIdentity=MemberIdentity.MemberIdentity

语法格式可以概括为:

FROM ((表1 INNER JOIN 表2 ON 表1.字段号=表2.字段号) INNER JOIN 表3 ON 表1.字段号=表3.字段号) INNER JOIN 表4 ON Member.字段号=表4.字段号

4、连接五个数据表的用法:

FROM (((Member INNER JOIN MemberSort ON Member.MemberSort=MemberSort.MemberSort) INNER JOIN MemberLevel ON Member.MemberLevel=MemberLevel.MemberLevel) INNER JOIN MemberIdentity ON Member.MemberIdentity=MemberIdentity.MemberIdentity) INNER JOIN Wedlock ON Member.Wedlock=Wedlock.Wedlock

语法格式可以概括为:

FROM (((表1 INNER JOIN 表2 ON 表1.字段号=表2.字段号) INNER JOIN 表3 ON 表1.字段号=表3.字段号) INNER JOIN 表4 ON Member.字段号=表4.字段号) INNER JOIN 表5 ON Member.字段号=表5.字段号
Copy after login
source:php.cn
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template