“该表达式输入错误,或太复杂以致不能估值。例如,一个数值表达式中可能含有太多复杂元素。试着将表达式的一部分赋值到变量来将表达式简化”
我也不知道是怎么回事,请高手帮忙!
附:联合查询
SELECT Null AS 日期, "" AS 凭证号, NsAsq明细账_期初余额.cCode AS 科目编码, "期初余额" AS 摘要,Null as 借方,Null as 贷方,bq期初方向 as 方向,bq期初余额 as 余额 ,0 as order1
FROM NsAsq明细账_期初余额
UNION
SELECT NsAsq明细账base本期合计.制单日期之Max, null AS 表达式1, "" AS 表达式2, "本月合计" AS 表达式3, NsAsq明细账base本期合计.本月借方合计, NsAsq明细账base本期合计.本月贷方合计, Null AS 表达式4, Null AS 表达式5,2 as order1
FROM NsAsq明细账base本期合计
UNION SELECT 制单日期之Max, Null AS 表达式1, Null AS 表达式2, "本期累计" AS 表达式3, 本期借方累计, 本期贷方累计, 期末方向, 期末余额,3 as order1
FROM NsAsq明细账base本期累计及余额
ORDER BY 日期, order1;
2 个解决方案
#1
看上去语法没错,加()和去掉后两句的别名试试:
(SELECT Null AS 日期, "" AS 凭证号, a.cCode AS 科目编码, "期初余额" AS 摘要,Null as 借方,Null as 贷方,a.bq期初方向 as 方向,a.bq期初余额 as 余额 ,0 as order1
FROM NsAsq明细账_期初余额 a)
UNION all
(SELECT b.制单日期之Max, null, "", "本月合计", b.本月借方合计,b.本月贷方合计, Null, Null,2
FROM NsAsq明细账base本期合计 b)
UNION all
(SELECT 制单日期之Max, Null, Null, "本期累计", c.本期借方累计, c.本期贷方累计, c.期末方向, c.期末余额,3
FROM NsAsq明细账base本期累计及余额 c)
ORDER BY 日期, order1;
(SELECT Null AS 日期, "" AS 凭证号, a.cCode AS 科目编码, "期初余额" AS 摘要,Null as 借方,Null as 贷方,a.bq期初方向 as 方向,a.bq期初余额 as 余额 ,0 as order1
FROM NsAsq明细账_期初余额 a)
UNION all
(SELECT b.制单日期之Max, null, "", "本月合计", b.本月借方合计,b.本月贷方合计, Null, Null,2
FROM NsAsq明细账base本期合计 b)
UNION all
(SELECT 制单日期之Max, Null, Null, "本期累计", c.本期借方累计, c.本期贷方累计, c.期末方向, c.期末余额,3
FROM NsAsq明细账base本期累计及余额 c)
ORDER BY 日期, order1;
#2
尽量用E文字做字段名。
#1
看上去语法没错,加()和去掉后两句的别名试试:
(SELECT Null AS 日期, "" AS 凭证号, a.cCode AS 科目编码, "期初余额" AS 摘要,Null as 借方,Null as 贷方,a.bq期初方向 as 方向,a.bq期初余额 as 余额 ,0 as order1
FROM NsAsq明细账_期初余额 a)
UNION all
(SELECT b.制单日期之Max, null, "", "本月合计", b.本月借方合计,b.本月贷方合计, Null, Null,2
FROM NsAsq明细账base本期合计 b)
UNION all
(SELECT 制单日期之Max, Null, Null, "本期累计", c.本期借方累计, c.本期贷方累计, c.期末方向, c.期末余额,3
FROM NsAsq明细账base本期累计及余额 c)
ORDER BY 日期, order1;
(SELECT Null AS 日期, "" AS 凭证号, a.cCode AS 科目编码, "期初余额" AS 摘要,Null as 借方,Null as 贷方,a.bq期初方向 as 方向,a.bq期初余额 as 余额 ,0 as order1
FROM NsAsq明细账_期初余额 a)
UNION all
(SELECT b.制单日期之Max, null, "", "本月合计", b.本月借方合计,b.本月贷方合计, Null, Null,2
FROM NsAsq明细账base本期合计 b)
UNION all
(SELECT 制单日期之Max, Null, Null, "本期累计", c.本期借方累计, c.本期贷方累计, c.期末方向, c.期末余额,3
FROM NsAsq明细账base本期累计及余额 c)
ORDER BY 日期, order1;
#2
尽量用E文字做字段名。