select create_date ,major_biz_name ,minor_biz_name ,minimal_biz_name ,call_type ,service_line ,finance_type ,min_cnt ,finance_user_cnt from from ( select '${zdt.addDay(-1).format("yyyy-MM")}' create_date ,major_biz_name ,minor_biz_name ,minimal_biz_name ,call_type ,service_line ,finance_type ,count(1) min_cnt from dm_pay.finance_call_in_cnt_di where substr(cast(day as string),1,6)='${zdt.addDay(-1).format("yyyyMM")}' group by major_biz_name ,minor_biz_name ,minimal_biz_name ,call_type ,service_line ,finance_type ) a left join ( select max(user_cnt) finance_user_cnt from --dm_njbi.cc_damage_kpi_v2_di dm_njbi.active_user_30days_finance_di where day =${zdt.addDay(-1).format("yyyyMMdd")} ) b on 1=1 ; sql哪里不合法
时间: 2024-04-13 15:28:45 浏览: 123
您的SQL语句中存在一处不合法的地方,即在最外层的FROM子句之后没有指定要查询的表名或子查询。您需要将要查询的表名或子查询添加到FROM子句中,例如:
```sql
SELECT
create_date,
major_biz_name,
minor_biz_name,
minimal_biz_name,
call_type,
service_line,
finance_type,
min_cnt,
finance_user_cnt
FROM (
SELECT
'${zdt.addDay(-1).format("yyyy-MM")}' AS create_date,
major_biz_name,
minor_biz_name,
minimal_biz_name,
call_type,
service_line,
finance_type,
COUNT(1) AS min_cnt
FROM dm_pay.finance_call_in_cnt_di
WHERE SUBSTR(CAST(day AS STRING), 1, 6) = '${zdt.addDay(-1).format("yyyyMM")}'
GROUP BY
major_biz_name,
minor_biz_name,
minimal_biz_name,
call_type,
service_line,
finance_type
) a
LEFT JOIN (
SELECT MAX(user_cnt) AS finance_user_cnt
FROM dm_njbi.active_user_30days_finance_di
WHERE day = ${zdt.addDay(-1).format("yyyyMMdd")}
) b ON 1=1;
```
请将您要查询的表名或子查询添加到相应位置后重新执行查询。
阅读全文