如何以特定格式显示thr结果的摘要? [英] how to show summary of thr result in a particular format?

查看:82
本文介绍了如何以特定格式显示thr结果的摘要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我收到服务中的一些数据。它是这种格式



Hello ,
I am recieving some data from the service . It's in this format

WareHouse   WareHouseType    Type     

AAA             1             11
AAA             1             12
AAA             1             13
AAA             1             12
BBB             1             11
AAA             1             12
AAA             1             12
BBB             1             11
BBB             1             12    





现在我需要这种格式的结果





Now i need result in this format

warehouse      WareHouseType    Type   Count
AAA               1              11     1
AAA               1              12     4
AAA               1              13     1
BBB               1              11     2
BBB               1              12     1  





任何建议如何实现这个?我尝试搜索有关数据表内的分组,但没有运气..



any suggestion how to achive this ?? I tried search about grouping inside datatable but no luck..

推荐答案





我可以建议你是一种方式。这可能不是解决方案,但您可以尝试。我相信会有更多这样的解决方案。



如果您的数据是DataTable格式,那么您可以按照以下步骤获得所需的结果。 />


1.)将DataTable导入数据库表(临时表)。

2.)将数据导入表后,即可根据您的数据使用Partition By子句进行整理。

3.)在查询中按列分区计数,并重新调整最后一列。



如需参考:

Partition By

将数据表插入数据库



希望这有助于您实现目标。这是您完成任务的方式之一。可能还有更多。



谢谢,

Sisir Patro
Hi,

I can suggest you one way. This might not be a solution but you can try. I am sure there would be more such type of solutions.

If your data is in DataTable format then you can follow the following steps to get the required result.

1.) Import the DataTable to a database table (Temporary table).
2.) Once the data is imported to the table you can use the "Partition By" clause based on your data to be sorted out.
3.) Put a count in the query for the partitioned by column and get the last column reformed.

For references:
Partition By
Inserting a datatable to DB

Hope this will help you in achieving the goal. This is one of the way you can achieve your task. There may be many more.

Thanks,
Sisir Patro


这篇关于如何以特定格式显示thr结果的摘要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆