本文介绍了根据具有group by的另一个字段的条件,在不同字段中对一个字段求​​和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!我是mssql的初级用户,我一直陷入了一个我想要制作的报告中。

我有一个包含''PartName''字段的表,'' VoucherQuantity'',''VoucherType'',''VoucherDate''和''DLName''。我想得到''VoucherQuantity''的总和,我想根据''VoucherType''的不同值(例如可以是01,02,03或04)在不同的字段中得到结果,我想要结果按''PartName''和''DLName''分组。显然我想要这个总和在哪里''VoucherDate''在a和b之间。

我一直在尝试不同的查询,我尝试创建不同的视图来解决这个问题,但到目前为止我有zilch。如果有人能帮助我,我会非常感激!

Hi! I''m a beginner user of mssql and I''ve been stuck in a report that I''m trying to make.
I have a table with fields like ''PartName'', ''VoucherQuantity'', ''VoucherType'', ''VoucherDate'', and ''DLName''. I want to get the sum of ''VoucherQuantity'' and I want its results in different fields based on different values of ''VoucherType'' (which for example can be 01, 02, 03, or 04) and I want the result to be grouped by ''PartName'' AND ''DLName''. Obviously I want this sums WHERE ''VoucherDate'' IS BETWEEN a and b.
I''ve been trying different queries for a while and I have tried creating different views to solve this but so far I have got zilch. I''d really appreciate it a lot if anyone can help me!

推荐答案




这篇关于根据具有group by的另一个字段的条件,在不同字段中对一个字段求​​和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 03:37