05 June 2019 · Ryan-Dallas ·       Add to Favorites   Report

Convert Teradata qualify row_number() to Google BigQuery

How can I translate this query into Big query?

(select row_number() over (order by tablename) subsequent_month from dbc.tables 
qualify row_number() over (order by tablename) <= 24)

There is no QUALIFY command in Bigquery.

Below is for BigQuery Standard SQL equivalent:

#standardSQL
SELECT subsequent_month FROM (
  SELECT ROW_NUMBER() OVER (ORDER BY tablename) subsequent_month 
  FROM dbc.tables 
) WHERE subsequent_month <= 24

Ryan-Dallas

posted on 05 June 2019

Read great educational content like this and a lot more !

Members get free exclusive access to content, new courses, and discounts. Signup for a free account to write a post / comment / upvote posts. Creating an account takes less than 5 seconds and you can start earning badges & points too

Copied