【发布时间】:2018-09-19 12:52:34
【问题描述】:
Tablename: call
-------------------
|id | name |
-------------------
| 1 | a |
| 2 | b |
| 3 | c |
| 4 | d |
| 5 | e |
-------------------
Tablename: call_detail
--------------------------------
|id | detail | call_id |
--------------------------------
|1 | note-1 | 1 |
|2 | note-2 | 1 |
|3 | note-3 | 2 |
|4 | note-4 | 2 |
|5 | note-5 | 2 |
|6 | note-6 | 3 |
--------------------------------
需要结果
----------------------
| id | name | detail |
| 1 | a | note-2 |
| 2 | b | note-5 |
| 3 | c | note-6 |
| 4 | d | null |
| 5 | e | null |
----------------------
如何左连接两个表最后插入id
我需要左加入 call.id = call_detail.call.id 最后一条记录
有没有办法做到这一点
你能用一个简单的样本来展示吗
【问题讨论】: