how insert query with sub-select query?
Posted by:
dsad das
Date: March 20, 2016 03:51PM
Hi,
i have two tabel
Table 1 [user]
has colums
id,username,email,password
Tabel 2 [user_info]
has colums
id,name,father_name,age,address,user_id
user_info.user_id is refernce to user.id
now the query i want to do is that first i add user in user table
then insert query on user_info with user_id how i can do that
i try to do 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',(select max(user.id) as id from user);
i want to get the user_id using select
so how i can do that ?