0

is it possible to add a select in a return statement?

insert into user_skills_languages 
(
  user_id, 
  skill_id,
  skill_type_id
)
values(
  213,
  1,
  0
)
returning skill_id, skill_type_id, select name from skills where skill_id = 1

I tried adding the select name from skills where skill_id = 1 but not sure if this is possible or I just don't have the syntax right.

1 Answer 1

2

Yes, that is possible, but you have to enclose a subquery in parentheses:

RETURNING skill_id,
          skill_type_id,
          (SELECT name FROM skills WHERE skill_id = 1)
Sign up to request clarification or add additional context in comments.

Comments

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.