abhishek jha
abhishek jha

Reputation: 1095

Qualify equivalent clause in BigQuery Standard SQL

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

Answers (2)

gaatjeniksaan
gaatjeniksaan

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

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

Related Questions