Reputation: 407
I am joining multiple tables using Wild table, I want the end date to be current date and start date can be static as shown in below query. But Query returned zero result If I replace hardcoded date to cast(current_date as string). Please help me on this
select * FROM
`test.session_streaming_*`
WHERE
_table_suffix BETWEEN '20180101'
AND cast(current_date as string)
Upvotes: 0
Views: 171
Reputation: 48
current_date
returns date in a format %Y-%m-%d
. You should use FORMAT_DATE function (https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#format_date) to get correct results:
FORMAT_DATE("%Y%m%d", current_date)
Upvotes: 1