如何在动态表列中求和值。 [英] How Sum values in dynamic table column.
问题描述
有人可以帮我这个
我有一个Access数据库,我有一个类似结构的表和列名列'a'和列'b'。我可以使用以下查询来获得此输出。
表|结果
------- | --------
can someone help me with this
I have an Access Database on which I have tables with similar structure and columns name column ‘a’ and column ‘b’. I can use the below query to get this output.
Table | result
-------|--------
SELECT "Table1" AS Table, SUM(a) - SUM(b) AS Result FROM table1 UNION SELECT "Table2" AS Table, SUM(a) - SUM(b) AS Result FROM table2 UNION SELECT "Table3" AS Table, SUM(a) - SUM(b) AS Result FROM table3
我想知道有没有办法编写查询而无需在查询中对表名进行硬编码?我在同一标题下发布了论坛的c#部分。
www.codeproject.com/ .. ./How-Sum-values-in-dynamic-table-column [ ^ ]
推荐答案
你能告诉我一个如何在ms中做到这一点的例子请访问?
can you show me an example how to do it in ms access please?
这篇关于如何在动态表列中求和值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!