diff --git a/src/Database/Queries/Date.php b/src/Database/Queries/Date.php index 2772cce..e246906 100644 --- a/src/Database/Queries/Date.php +++ b/src/Database/Queries/Date.php @@ -152,6 +152,13 @@ class Date extends Base { 'AND' ); + + /** + * @since 2.0.2 + * @var string|null Table name + */ + public $table_name = null; + /** * Constructor. * @@ -388,6 +395,10 @@ public function get_column( $query = array() ) { ? esc_sql( $this->validate_column( $query['column'] ) ) : $this->column; + if (!empty($this->table_name)) { + $retval = $this->table_name . '.' . $retval; + } + return $retval; } @@ -645,8 +656,9 @@ public function validate_column( $column = '' ) { * * @return string MySQL WHERE clauses. */ - public function get_sql() { - $sql = $this->get_sql_clauses(); + public function get_sql( $type, $primary_table, $primary_id_column, $context = null ) { + $this->table_name = $this->sanitize_table_name( $primary_table ); + $sql = $this->get_sql_clauses(); /** * Filters the date query clauses.