I am working with two databases,primary and secondary. both contains same schema. now i cant to update column of primary database with the content of same column from secondary database provided the data in secondary database is not NULL.
ATTACH "secondary.db" as second;
UPDATE main.table set main.value = coalesce((SELECT value FROM second.table),main.value);
but the above code does not work and only the first value of the column from the secondary database is copied to all values in the column in primary database.
For Eg. primary database:
index, value
1, 45
2, 56
3, 23
secondary database:
index, value
1, NULL
2, 55
3, NULL
expected result database:
index, value
1, 45
2, 55
3, 23
Any suggestions?
here you can see what is i am trying: http://sqlfiddle.com/#!5/845545/1