dimanche 11 janvier 2015

Sql Insert with dynamic values


Vote count:

0




I am using following query on postgres database:



insert into user_settings (google_access_token, google_refresh_token)
select 'google_access_token', 'google_refresh_token' from user
where id = user_id


table user_settings has a field user_id which corresponds to field named id in user table. but this gives the error:



column "user_id" does not exist
Hint: There is a column named "user_id" in table "user_settings",
but it cannot be referenced from this part of the query


asked 38 secs ago







Sql Insert with dynamic values

Aucun commentaire:

Enregistrer un commentaire