select n.orgname, n.orgcode, n.zbz as zbz from ( SELECT c.orgname, c.orgcode,…
- User
select n.org_name, n.org_code, n.zbz as zbz
from ( SELECT c.org_name, c.org_code, IFNULL(sum(m.zbz),0) as zbz FROM ( SELECT org_code, org_name FROM nhp_manage.sys_org WHERE area_code like CONCAT(REGEXP_REPLACE('', ''), '%') ) c left join ( select t.jgbm, sum(t.zbz) as zbz, zbmc from nhp_bi.ads_index_public_health_data t where t.zbdm ='GGWS_XSR_FSRC' and daykey like CONCAT('${year}','%')
- Assistant
The error message you've provided indicates that there is a syntax error in your SQL query. Specifically, the error seems to be around the
LIKE =syntax used in yourLEFT JOIN. TheLIKEoperator should be used to match a pattern, and it does not require an=sign. Additionally, yourGROUP BYclause seems to have an issue with the number of columns specified.Here's a revised version of your SQL query:
sql