SQLite Forum

Can I do this as one liner?
Login
Hello,

I have a big table like this:

~~~tcl
sqlite3 ::db ":memory:"
::db eval {
  create table tbl (type,name,value);
  insert into tbl values('A','name1','value1');
  insert into tbl values('B','name1','');
  insert into tbl values('A','name2','value2');
  insert into tbl values('B','name2','');
}
~~~

Then I will update values. Is it possible to make this faster in one statement?

~~~tcl
::db eval {select type,name,value from tbl where type='A'} r {
  ::db eval {update tbl set value=$r(value) where type='B' and name=$r(name)}
}
~~~

Thank you