0
insert into nt_nurture_profile (credit,user_id,wallet_key)
values (0, select person_id from ct_student where person_id not in(select user_id from nt_nurture_profile), gen_random_uuid ());

this is my code but ran into an error

syntax error at or near "select"

but when i use select in single line it works!

0

1 Answer 1

1

The below select statements works

insert into nt_nurture_profile (credit,user_id,wallet_key)
select 0, person_id, gen_random_uuid ()
  from ct_student 
  where person_id not in(select user_id from nt_nurture_profile));
Sign up to request clarification or add additional context in comments.

2 Comments

If by "fill all the values manually" you mean that VALUES does not support subqueries, then this answer is wrong (although the code portion is fine).
Correct, I reworded the reply

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.