Reputation: 1095
Is there any equivalent 'Qualify' clause of Teradata in BigQuery Standard SQ?
I need it because we cant use analytic functions in Where/Having clause.
Upvotes: 2
Views: 4807
Reputation: 1431
It has since been released (was pre-GA at the time of writing, now GA as pointed out by Ran below):
https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#qualify_clause
Upvotes: 4
Reputation: 31
The equivalent query is:
SELECT * EXCEPT (_row_number)
FROM (SELECT {{ COLUMNS }}
, ROW_NUMBER() {{ RULE }} AS _row_number
FROM {{ MY_TABLE }}) AS t
WHERE _row_number = 1
Upvotes: 3