This is probably a really obvious mistake, but I have been trying a number of things and I do not seem to be able to get the right answer.
From R, I try to execute the following DELETE SQL statement on a PostgreSQL database hosted by Digital Ocean.
sql <- "DELETE FROM tablename WHERE referenceNo IN (380,376,344,345)"
conn %>% dbExecute(sql)
I get the following error and I am unable to find the correct syntax.
Error: Failed to prepare query: ERROR: column "referenceno" does not exist
LINE 1: DELETE FROM tablename WHERE referenceNo IN (380,37...
^
HINT: Perhaps you meant to reference the column "tablename.referenceNo".
I have tried to follow the hint and tried SQL syntax like:
sql <- "DELETE FROM tablename WHERE tablename.referenceNo IN (380,376,344,345)"
Unfortunately, I get the same error message.