select tanhui_xiangmu_carbon.id, sum(carbonStore) from xm_mu_product, xm_user_tree, tanhui_xiangmu_carbon where xm_mu_product.tree_id=xm_user_tree.id and tanhui_xiangmu_carbon.id=xm_user_tree.carbon_id and tanhui_xiangmu_carbon.id='1
8' group by year having xm_mu_product.year in(select max(xm_jisuan_parameter.year) from xm_jisuan_parameter, xm_user_tree, xm_mu_product where xm_jisuan_parameter.tree_id=xm_user_tree.id and tanhui_xiangmu_carbon.id=xm_user_tree.carbon_id and tanhui_xiangmu_carbon.id='18')
加粗地方为主键,不添加时时会报错!