querySELECT {pgTools}R Documentation

Generate a PostgreSQL select statement, optionally execute the statement if con is not NULL.

Description

Generate a PostgreSQL select statement, optionally execute the statement if con is not NULL.

Usage

querySELECT(
  select,
  from = list(),
  where = NULL,
  group_by = NULL,
  having = NULL,
  order_by = NULL,
  con = NULL
)

Arguments

select

A vector of columns/items to select.

from

A string, the table(s) to select from.

where

A string, text to include in the where clause.

group_by

A vector of columns/items to group by.

having

A vector of conditions to be met by aggregations.

order_by

A vector of columns/items to order by.

con

A database connection that can be passed to DBI::dbSendQuery/DBI::dbGetQuery.

Value

A string, PostgreSQL select statement; or the results retrieved by DBI::dbGetQuery after executing the statement.

Examples

querySELECT(
select = c("col1", "col2", "col1 + col2 AS col3"),
from = "schema1.table1"
)

[Package pgTools version 1.0.2 Index]