i want to set the value to a insert query from select query ,how to perform this.
insert into t_user (id,user_id) values (1, )
where user_id in (select id from user where id=123)
I want to set the value of user_id from select query value ,how to do this in sql?
Try this:
INSERT INTO t_user (id, user_id)
SELECT 1, id
FROM user
WHERE id = 123
insert into t_user(id, user_id) select 1, id from user where id=123;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With