Answer the question
In order to leave comments, you need to log in
How to insert into the new json value, the value of another column in an UPDATE query?
Can you please tell me how to correctly specify subquery.email in this request?
UPDATE group_settings
SET group_recepients='{"email": subquery.email, "telegram_token": "", "telegram_user_id":""}'
FROM (SELECT id, email from users) AS subquery WHERE group_settings.user_id = subquery.id;
Answer the question
In order to leave comments, you need to log in
Something like this
UPDATE group_settings
SET group_recepients = jsonb_build_object('email', subquery.email, 'telegram_token', '', 'telegram_user_id', '')
FROM (SELECT id, email from users) AS subquery WHERE group_settings.user_id = subquery.id;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question