I have following query :
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;
I am getting duplicate primary key value =1 error ( which should be generated by last_insert_id() ). Here is the structure of tables
A
id|phoneNumber|name|address
---------------------------
B
id|phoneNumber|email
--------------------
C
id|phoneNumber|name|address
---------------------------
Could someone please help me why last_insert_id() is always returning 1.
More Info: id field in table A,B and C are auto_increamented.