表一:user
id | name | age |
1 | pshdhx | 24 |
表二:books
id | book_name | user_id |
100 | book1 | 1 |
200 | book2 | 1 |
select * from user left join books on user.id = books.user_id;
结果:
id | name | age | id | book_name | user_id |
1 | pshdhx | 24 | 100 | book1 | 1 |
1 | pshdhx | 24 | 200 | book2 | 1 |
无论是表一左连接表二,还是表二左连接表一,结果都是一样的。