Hello, I am trying to get a date range variable in a query that has UNION. Data is stored in BigQuery. Variable type of Date
only supports a single value & not a range so I am using Field Filter
.
SELECT
*
FROM
(
(
SELECT
TransactionID,
CreatedDate
FROM
`bill_payment.transactions_1`
)
UNION ALL
(
SELECT
TransactionID,
CreatedDate
FROM
`bill_payment.transactions_2`
)
)
WHERE
{{CreatedDate}};
The date range filter should apply to both tables. The problem is, in field filter I can select only 1 table. So whether I put the field filter variable outside or within the subqueries, it results in an error.
Is there a way I can make this work using a single date range field? Or is this not possible & I have to make 2 separate fields i.e. fromdate and todate?