我有时会遇到非常长的子句,我正在寻找一种方法,让我可以折叠它们,就像我可以折叠类,方法和命名空间一样。 有没有一个Visual Studio扩展可以做到这一点? ReSharper和JustCode都不允许。 谢谢!
USE AdventureWorks2008R2; GO SELECT SalesOrderID, ProductID, OrderQty ,SUM(OrderQty) OVER(PARTITION BY SalesOrderID) AS 'Total' ,AVG(OrderQty) OVER(PARTITION BY SalesOrderID) AS 'Avg' ,COUNT(OrderQty) OVER(PARTITION BY SalesOrderID) AS 'Count' ,MIN(OrderQty) OVER(PARTITION BY SalesOrderID) AS 'Min' ,MAX(OrderQty) OVER(PARTITION BY SalesOrderID) AS 'Max' FROM Sales.SalesOrderDetail WHERE SalesOrderID IN(43659,43664); 我读了关于这个条款,我不明白为什么我需要它。 这个functionOver做什么? Partitioning By做什么的? 为什么我无法通过编写Group By SalesOrderID进行查询?