如何创建所需的水晶报告。 [英] How to create the desired crystal report as mentioned.
本文介绍了如何创建所需的水晶报告。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表
ProductID SoreID员工ID产品类型产品价格DateBrought
1 R0001 E0001 UCO 12 2350.0000 02-Feb-19
2 MK001 E0019 UCO 15 4000.0000 02-Feb-19
3 MD001 E0017 UCO 10 2350.0000 03-Mar-19
4 MD001 E0018 UCO 20 3500.0000 03-Mar-19
5 MK001 E0020 UCO 14 3700.0000 02-Feb-19
6 R0001 E0003 UCO 11 3000.0000 02-Feb-19
7 R0001 E0004 UCO 14 3500.0000 02-Feb-19
I想要报告如下一个
StoreID Empid 02-Feb-19 03-Feb-19 04-Feb-19 05-Feb-19 ---- 28-Feb-19 Total
R0001 E0001 12 10 7 8 11 xx
MK001 E0002 10 10 6 5 10 xx
我有什么尝试过:
我已经在报告中应用了一个交叉表但没有得到所需的格式。
解决方法
你必须创建枢查询行转换成列。请参阅:
使用PIVOT和UNPIVOT - SQL Server | Microsoft Docs [ ^ ]
在SQL查询中使用Pivot的简单方法 [ ^ ]
SQL Server:PIVOT子句 [ ^ ]
SQL SERVER - PIVOT和UNPIVOT表示例 [ ^ ]
用于在SQL Server中创建动态PIVOT查询的脚本 [ ^ ]
祝你好运!
I have a Table ProductID SoreID EmployeeID ProdType ProdQTy Price DateBrought 1 R0001 E0001 UCO 12 2350.0000 02-Feb-19 2 MK001 E0019 UCO 15 4000.0000 02-Feb-19 3 MD001 E0017 UCO 10 2350.0000 03-Mar-19 4 MD001 E0018 UCO 20 3500.0000 03-Mar-19 5 MK001 E0020 UCO 14 3700.0000 02-Feb-19 6 R0001 E0003 UCO 11 3000.0000 02-Feb-19 7 R0001 E0004 UCO 14 3500.0000 02-Feb-19 I Want a report such as below one StoreID Empid 02-Feb-19 03-Feb-19 04-Feb-19 05-Feb-19 ---- 28-Feb-19 Total R0001 E0001 12 10 7 8 11 xx MK001 E0002 10 10 6 5 10 xx
What I have tried:
I have applied a cross tab to the report but not getting the desired format.
解决方案
You have to create pivot query to convert rows into columns. See:
Using PIVOT and UNPIVOT - SQL Server | Microsoft Docs[^]
Simple Way To Use Pivot In SQL Query[^]
SQL Server: PIVOT Clause[^]
SQL SERVER – PIVOT and UNPIVOT Table Examples[^]
Script to create dynamic PIVOT queries in SQL Server[^]
Good luck!
这篇关于如何创建所需的水晶报告。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文