请问我怎么根据日志表的log_id字段取得客户表的name字段呢?用tp的写法,求解
日志表:log
+------------------+--------------+------+-----+---------+----------------+
| log_id | int(10) | NO | PRI | NULL | auto_increment |
| role_id | int(11) | NO | | NULL | |
| category_id | int(10) | NO | | NULL | |
| create_date | int(10) | NO | | NULL | |
| update_date | int(10) | NO | | NULL | |
| subject | varchar(200) | NO | | NULL | |
| content | text | NO | | NULL | |
| comment_id | int(10) | NO | | NULL | |
| about_roles | varchar(200) | NO | | NULL | |
| about_roles_name | varchar(500) | NO | | NULL | |
| belong_to_user | varchar(30) | NO | | NULL | |
| customer | varchar(155) | YES | | NULL | |
+------------------+--------------+------+-----+---------+----------------+
日志客户中间表:r_customer_log
+-------------+---------+------+-----+---------+----------------+
| id | int(10) | NO | PRI | NULL | auto_increment |
| customer_id | int(10) | NO | | NULL | |
| log_id | int(10) | NO | | NULL | |
+-------------+---------+------+-----+---------+----------------+
客户表:customer
+----------------------+--------------+------+-----+---------+----------------+
| customer_id | int(10) | NO | PRI | NULL | auto_increment |
| owner_role_id | int(10) | NO | | NULL | |
| creator_role_id | int(10) | NO | | NULL | |
| contacts_id | int(10) | NO | | 0 | |
| name | varchar(333) | NO | | | |
| origin | varchar(150) | NO | | | |
| industry | varchar(150) | NO | | | |
| annual_revenue | varchar(20) | NO | | NULL | |
| create_time | int(10) | NO | | NULL | |
| update_time | int(10) | NO | | NULL | |
| is_deleted | int(1) | NO | | NULL | |
| is_locked | int(1) | NO | | NULL | |
| delete_role_id | int(10) | NO | | NULL | |
| delete_time | int(10) | NO | | NULL | |
| biz_type | varchar(255) | NO | | | |
+-------------+---------+------+-----+---------+------------------------------+
1这个是sql的多表关联
我先写个sql吧!
就是这样写的