在本地的mysql执行能成功,但是在活字格内提示我conact方法不存在。
而且我的日期类型被转换的有点奇怪。附上sql,哪位大佬能帮忙看下
主要问题就是concat这个函数用不了,应该可以用+代替,但是我的日期类型被转换成了负数select b.*,c.* from (select category,sum(weight) as stoweight,sum(cost) as stocost,
if((date(addtime)>date(concat(year((addtime)),'/',06,'/',01)) and
date(addtime)<date(concat(year(addtime)+1,'/',05,'/',30))),
concat(year(addtime),'~',year(addtime)+1,'年度'),
concat(year(addtime)-1,'~',year(addtime),'年度')
)stoniandu
from om_ch_storage
group by category,stoniandu) b
left join
(select a.category as usecategory,sum(a.weight) as useweight,
if((date(a.addtime)>date(concat(year((a.addtime)),'/',06,'/',01)) and
date(a.addtime)<date(concat(year(a.addtime)+1,'/',05,'/',30))),
concat(year(a.addtime),'~',year(a.addtime)+1,'年度'),
concat(year(a.addtime)-1,'~',year(a.addtime),'年度')
)niandu
from
(select addtime, '小麦秸秆' category , wstraw as weight from om_ch_use
union
select addtime, '玉米秸秆' category , cstraw as weight from om_ch_use
union
select addtime, '辣椒秸秆' category , pstraw as weight from om_ch_use
union
select addtime, '山楂枝条' category , hstraw as weight from om_ch_use
union
select addtime, '树木枝条' category , tstraw as weight from om_ch_use) as a
group by category,niandu)c
on b.stoniandu=c.niandu and b.category=c.usecategory
|