2

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.

abhishek jha
  • 1,065
  • 4
  • 21
  • 41

2 Answers2

4

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

gaatjeniksaan
  • 1,412
  • 2
  • 12
  • 17
3

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