本文介绍了汇总总和查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述如何汇总SUM 与父母使用TSQL的余额How to rollup SUM  balance with parent using TSQLLINE_NOPARENT BALANCE318503100003185531850031860318550318653185503187031850031875318705911566331880318702797447303188531870031890318700318953187003190031870203240003192031850031925319202351894231930319200 输出量必须 LINE_NO PARENT_LINE_NO BALANCE 31850 31000 382703335.22 31855 31850   31860 31855 0.00 31865 31855 0.00 31870 31850 359184392.94 31875 31870 59115662.90 31880 31870 279744730.10 31885 31870 0.00 31890 31870 0.00 31895 31870 0.00 31900 31870 20323999.94 31920 31850 23518942.28 31925 31920 23518942.28 31930 31920 0.00OUTPUT SOULD BELINE_NOPARENT_LINE_NOBALANCE3185031000382703335.223185531850 31860318550.0031865318550.003187031850359184392.94318753187059115662.903188031870279744730.1031885318700.0031890318700.0031895318700.00319003187020323999.94319203185023518942.28319253192023518942.2831930319200.00推荐答案 格林先生,为了给我们提供测试您的查询和我们的解决方案的工具,请发布: 1)查询创建您的表格,包括索引   2)查询 插入样本数据。   3)给出样本的预期结果,例如excel的文本或图像。   4)简短说明业务规则,以及如何获得1-2的结果   5)您正在使用哪个版本的SQL Server(这将有助于使查询符合您的版本)。In order to give us the tools to test your query and our solution, please post:1) Queries to CREATE your table(s) including indexes 2) Queries  to INSERT sample data. 3) The desired result given the sample, as text or image of excel for example. 4) A short description of the business rules, and how you got 1-2 of the results 5) Which version of SQL Server you are using (this will help to fit the query to your version).对于上面的示例数据,我不清楚样本数据是真实的样本数据还是所需的输出。能否请您提供更详细的信息?For the sample data above, I am not clear that the sample data is real sample data or desired output. Could you please provide us more detailed information?最好的问候,将 这篇关于汇总总和查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-11 08:41