【发布时间】:2018-09-28 06:18:19
【问题描述】:
下面是我收到错误的脚本
错误:无法识别的名称:m01_order_datetime_gmt0 at [9:19]
代码
`select
case
when number_of_bookings = 1 then '1'
when number_of_bookings = 2 then '2'
when number_of_bookings = 3 then '3'
else '>3' end as number_of_bookings,
count(user_id) as number_of_users,
date_trunc(date(m01_order_datetime_gmt0), month) as Booking_month
from
(select
user_id,
count(distinct order_id) number_of_bookings
from analyst_all_orders
where 1=1
and d181_business_platform_code is not null
and date(m01_order_datetime_gmt0) between '2018-03-01' AND '2018-08-31'
group by 1
order by 1) as a
group by 1
order by 1`
【问题讨论】:
-
我无法给出确切的答案,但我会指出您在子查询中别名为
a的ORDER BY要么不正确,要么至少毫无意义。你应该删除它。
标签: google-bigquery