Skip to content
Advertisement

Tag: date-arithmetic

Writing a sub-query using a date clause

So basically I’m trying to write something that prints the customer’s name and area code if they have made a booking within the last 6 months of the current date. My code looks like this (it has to be a subquery, not using join) Yet it doesn’t work, but I can get it to work using a join function, but

Order count per ID and calculate time between orders in BigQuery

I am working with customer purchase data and am trying to write a query in Google BigQuery that sorts all purchases by date and adds a purchase/order count per customer (order_count). Also, I would like to calculate a time-delay (in days) between the orders of one customer (purchase_latency). My query currently looks like this: The result including “order_count” and “purchase_latency”

Advertisement