"Select YEAR(年), sum(收入) as 收入, sum(支出) as 支出 f rom " _ & "(Select sys_user, 销售_日期 as 年, 销售_金额 as 收入, 0 as 支出 f rom {母猪基本信息} u nion all " _ & "Select sys_user, 销售_日期, 销售_金额, 0 f rom {公猪信息} u nion all " _ & "Select sys_user, 销售_日期, 销售_金额, 0 f rom {肉猪信息} u nion all " _ & "Select sys_user, 日期, 金额, 0 f rom {补贴项目} u nion all " _ & "Select sys_user, 日期, 金额, 0 f rom {其他收入} u nion all " _ & "Select sys_user, 购买_日期, 0, 购买_金额 f rom {母猪基本信息} u nion all " _ & "Select sys_user, 购买_日期, 0, 购买_金额 f rom {公猪信息} u nion all " _ & "Select sys_user, 购买_日期, 0, 购买_金额 f rom {肉猪信息} u nion all " _ & "Select sys_user, 日期, 0, 饲料量_总金额 f rom {饲料采购} u nion all " _ & "Select sys_user, 日期, 0, 总金额 f rom {疫苗采购} u nion all " _ & "Select sys_user, 日期, 0, 总金额 f rom {药品采购} u nion all " _ & "Select sys_user, 日期, 0, 总金额 f rom {易耗品采购} u nion all " _ & "Select sys_user, 日期, 0, 投保金额 f rom {保险费} u nion all " _ & "Select sys_user, 日期, 0, 金额 f rom {水电费} u nion all " _ & "Select sys_user, 日期, 0, 金额 f rom {工资费用} u nion all " _ & "Select sys_user, 日期, 0, 支出金额 f rom {工程折旧费用} u nion all " _ & "Select sys_user, 日期, 0, 金额 f rom {其他支出} ) " _ & "As a where [sys_user] ='" & user.Name & "' group by year(年) order by year(年) "
|