|
如下ksql,报错说1337 缺少右括号,可该sql放在mysql里是可执行的
select f.fileName,l.syear,l.mont1,l.mont2,l.mont3,l.mont4,l.mont5,l.mont6,l.mont7,l.mont8,l.mont9,l.mont10,l.mont11,l.mont12
from (SELECT t.fileName,t.fileCode from t_files t JOIN t_file_detail t2 on t.fileCode = t2.fileCode where t.fileType = 1 and t2.unitId = '010000' and t2.delFlag = 0) f JOIN
(SELECT licenseCode, licenseClass,year(t_license.applyDatetime) as syear,
case when month(t_license.applyDatetime) = '1' then 1 else 0 end as mont1,
case when month(t_license.applyDatetime) = '2' then 1 else 0 end as mont2,
case when month(t_license.applyDatetime) = '3' then 1 else 0 end as mont3,
case when month(t_license.applyDatetime) = '4' then 1 else 0 end as mont4,
case when month(t_license.applyDatetime) = '5' then 1 else 0 end as mont5,
case when month(t_license.applyDatetime) = '6' then 1 else 0 end as mont6,
case when month(t_license.applyDatetime) = '7' then 1 else 0 end as mont7,
case when month(t_license.applyDatetime) = '8' then 1 else 0 end as mont8,
case when month(t_license.applyDatetime) = '9' then 1 else 0 end as mont9,
case when month(t_license.applyDatetime) = '10' then 1 else 0 end as mont10,
case when month(t_license.applyDatetime) = '11' then 1 else 0 end as mont11,
case when month(t_license.applyDatetime) = '12' then 1 else 0 end as mont12
FROM t_license_detail
JOIN t_license ON t_license_detail.applyIdkey = t_license.idkey
WHERE year(t_license.applyDatetime)=:syear
order BY licenseCode,licenseClass) l on f.fileCode = l.licenseCode |
|