javascript - Knex - updating rows where value from select -


i using sqlite3 db , have these 2 tables.

list:

  • id
  • originid

attributes:

  • id
  • listid
  • originlist

attributes.originlist == list.originid

i need update rows in attributes match current list.id. using knex , current raw query looks this:

update attributes  set listid = (select id                list                originid = attributes.originlist) 

i started dbs , have been trying come ways without raw, haven't been successful. there such way?

something should create raw query mentioned in op:

knex('attributes').update({    listid: knex('list').select('id').where('originid', knex.raw('??', ['attributes.originlist'])) }) 

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -