|
SELECT DISTINCTROW Left([科目编码],4) AS 表达式1, Sum(Sheet1.贷方金额) AS 贷方金额之总计, Sum(Sheet1.借方金额) AS [借方金额 之 总计]
FROM Sheet1
WHERE (((Len([科目编码]))>=4))
GROUP BY Left([科目编码],4)
ORDER BY Left([科目编码],4)
UNION
SELECT DISTINCTROW Left([科目编码],6) AS 表达式1, Sum(Sheet1.贷方金额) AS 贷方金额之总计, Sum(Sheet1.借方金额) AS [借方金额 之 总计]
FROM Sheet1
WHERE (((Len([科目编码]))>=6))
GROUP BY Left([科目编码],6)
UNION
SELECT DISTINCTROW Left([科目编码],8) AS 表达式1, Sum(Sheet1.贷方金额) AS 贷方金额之总计, Sum(Sheet1.借方金额) AS [借方金额 之 总计]
FROM Sheet1
WHERE (((Len([科目编码]))>=8))
GROUP BY Left([科目编码],8)
UNION
SELECT DISTINCTROW Left([科目编码],10) AS 表达式1, Sum(Sheet1.贷方金额) AS 贷方金额之总计, Sum(Sheet1.借方金额) AS [借方金额 之 总计]
FROM Sheet1
WHERE (((Len([科目编码]))>=10))
GROUP BY Left([科目编码],10)
UNION
SELECT DISTINCTROW Left([科目编码],12) AS 表达式1, Sum(Sheet1.贷方金额) AS 贷方金额之总计, Sum(Sheet1.借方金额) AS [借方金额 之 总计]
FROM Sheet1
WHERE (((Len([科目编码]))>=12))
GROUP BY Left([科目编码],12)
UNION
SELECT DISTINCTROW Left([科目编码],14) AS 表达式1, Sum(Sheet1.贷方金额) AS 贷方金额之总计, Sum(Sheet1.借方金额) AS [借方金额 之 总计]
FROM Sheet1
WHERE (((Len([科目编码]))>=14))
GROUP BY Left([科目编码],14)
UNION
SELECT DISTINCTROW Left([科目编码],16) AS 表达式1, Sum(Sheet1.贷方金额) AS 贷方金额之总计, Sum(Sheet1.借方金额) AS [借方金额 之 总计]
FROM Sheet1
WHERE (((Len([科目编码]))>=16))
GROUP BY Left([科目编码],16);
[ 本帖最后由 zez 于 2009-10-30 14:50 编辑 ] |
|