sql-joining multiple tables with joins
SELECT * FROM table1 inner join table2 on Table1.id=table2.id
In fact INNER JOIN ... The syntax format for on is summarized as follows:
From ((Table 1 INNER join table 2 on table 1. Field number = Table 2. Field number) INNER join table 3 on table 1. Field number = Table 3. Field number) INNER join table 4 on Member. Field number = Table 4. Field number) INNER Join Table X on Member. Field number = table X. Field number
You just have to apply the format.
Examples of ready-made formats:
Although I have more understanding, but in order to take care of beginners, I still use this member registration system as an example, to provide some examples of the existing syntax format, you just need to modify the table name and field name.
To connect two data tables, use:
From Member INNER JOIN membersort on Member.membersort=membersort.membersort
The syntax format can be summarized as:
From table 1 INNER JOIN table 2 on table 1. Field number = Table 2. Field number
To connect three data tables, use:
From (Member INNER join Membersort on Member.membersort=membersort.membersort) INNER join Memberlevel on Member.memberlev El=memberlevel.memberlevel
The syntax format can be summarized as:
From (table 1 INNER join table 2 on table 1. Field number = Table 2. Field number) INNER JOIN table 3 on table 1. Field number = Table 3. Field number
To connect four data tables, use:
From ((Member INNER join Membersort on Member.membersort=membersort.membersort) INNER join Memberlevel on Member.memberle Vel=memberlevel.memberlevel) INNER JOIN memberidentity on member.memberidentity=memberidentity.memberidentity
The syntax format can be summarized as:
From (table 1 INNER join table 2 on table 1. Field number = Table 2. Field number) INNER join table 3 on table 1. Field number = Table 3. Field number) INNER join table 4 on Member. Field number = Table 4. Field number
To connect five data tables, use:
From (((Member INNER join Membersort on Member.membersort=membersort.membersort) INNER join Memberlevel on Member.memberl Evel=memberlevel.memberlevel) INNER JOIN memberidentity on member.memberidentity=memberidentity.memberidentity) INNER JOIN Wedlock on Member.wedlock=wedlock.wedlock
The syntax format can be summarized as:
From ((Table 1 INNER join table 2 on table 1. Field number = Table 2. Field number) INNER join table 3 on table 1. Field number = Table 3. Field number) INNER join table 4 on Member. Field number = Table 4. Field number) INNER Join Table 5 on Member. Field number = Table 5. Field number
Sql-joining multiple tables with joins