Skip to content
Advertisement

How to update certain rows using UPDATE function using sqldf R package?

I have two tables: dat1 and dat2.

The data looks like the following:

I want to update dat1 with dat2 when the file names are the same. Below is my code:

However, I always get the following error:

“Error: near “FROM”: syntax error”

No clue 🙁 Thank you for the help.

Advertisement

Answer

In many databases, you could use a correlated subquery for this:

If there may be missing matches in dat2, then:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement