View source: R/sql_expressions.R
hsSqlExAnd | R Documentation |
Creates a boolean expression of the form
bFunc(x1) AND bFunc(x2)
AND ... AND bFunc(xn)
. This function can be used to create SQL queries where
many table fields have to be checked in the same way for some criterion (see
example).
hsSqlExAnd(x, bFunc)
x |
vector of strings, e.g. representing table field names. |
bFunc |
name of a boolean function to be “applied” to each element of x. |
hsSqlExOr
## Build SQL query finding records in table t in which all
## of the table fields f1 to f100 are NULL.
sql <- sprintf("SELECT * FROM t WHERE %s",
hsSqlExAnd(paste("f", 1:100, sep = ""), "isNull"))
## Show the SQL string
sql
## Output (middle part omitted):
# SELECT * FROM t WHERE (TRUE) AND isNull(f1) AND
# isNull(f2) AND isNull(f3) AND ... AND isNull(f100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.