Site icon The Software Point

Including multiple SQL statements in a single RMarkdown Chunk

I am running SQL statements within my RMarkdown script but it seems that I can only execute 1 statement per chunk. For example running these individually works fine

```{sql}
select count(*) from table_1;
```

```{sql}
select count(2) from table_2;
```

but if I try combining them into a single chunk I get an error

```{sql}
select count(*) from table_1;
select count(*) from table_2;
```

ERROR: cannot insert multiple commands into a prepared statement

Of note I am connecting via DBI::dbConnect to a Redshift DB.

Exit mobile version