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

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -