date_between {lazysql} | R Documentation |
Create SQL string to select date between two given dates
Description
Create string with SQL BETWEEN
expression for WHERE
clause to select dates
within the given range.
Usage
date_between(column_name, date_range)
Arguments
column_name |
[character(1)] |
date_range |
[Date(1:2)] |
Details
column_name
must be a valid SQL identifier. It is validated to conform to
the regular expression returned by valid_identifier_regex
.
Value
Character string to be used in SQL statement.
Author(s)
Uwe Block
See Also
Examples
date1 <- as.Date("2016-02-22")
date2 <- as.Date("2016-02-11")
# SQL expression for a date range
(sql_expr1 <- lazysql::date_between("STD_1", c(date1, date2)))
# SQL expression for a single date
(sql_expr2 <- lazysql::date_between("STD_1", date1))
# sample SQL statements
paste("select * from TEST_TABLE where", sql_expr1)
paste("select * from TEST_TABLE where", sql_expr2)
[Package lazysql version 0.1.3 Index]