Re: how insert query with sub-select query?
>i want to get the user_id using select
>so how i can do that ?
SELECT last_insert_id();
Like this.
insert into user(id,username,password,email) values (1,'user1',1234.'user@email');
insert into user_info(id,name,father_name,address,user_id) values (1,'user-name','user-father','H block',last_insert_id());
http://dev.mysql.com/doc/refman/5.6/en/information-functions.html#function_last-insert-id
Good luck,
Barry.
Subject
Written By
Posted
Re: how insert query with sub-select query?
March 20, 2016 07:58PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.