我有以下查询:
insert into A select last_insert_id(),B.id,C.name,C.address,
from sample_table C join other_table B on B.phoneNumber=C.phoneNumber;
我收到重复的主键值 =1 错误(应该由 last_insert_id() 生成)。这是表的结构
A
id|phoneNumber|name|address
---------------------------
B
id|phoneNumber|email
--------------------
C
id|phoneNumber|name|address
---------------------------
有人可以帮我为什么 last_insert_id() 总是返回 1。
更多信息:表 A、B 和 C 中的 id 字段是 auto_increamented。