declare @t table( ProductID int, ProductName varchar(20), ProductType varchar(20), Price int)
insert @t select 1,'name1','P1',3 union all select 2,'name2','P1',5 union all select 3,'name3','P2',4 union all select 4,'name4','P2',4
select t1.* from @t t1 join (select ProductType, max(Price) Price from @t group by ProductType) t2 on t1.ProductType = t2.ProductType where t1.Price = t2.Price order by ProductType
;with cte as( select *, max(Price) over(partition by (ProductType)) MaxPrice from @t) select ProductID,ProductName,ProductType,Price from cte where Price = MaxPrice order by ProductType
WITH OrderInfo AS ( SELECT ROW_NUMBER() OVER(PARTITION BY EmployeeID ORDER BY OrderDate) AS Number, OrderID,CustomerID, EmployeeID,OrderDate FROM Orders (NOLOCK) ) SELECT Number,OrderID,CustomerID, EmployeeID ,OrderDate From OrderInfo WHERE Number BETWEEN 0 AND 10
WITH OrderInfo AS ( SELECT COUNT(OrderID) OVER(PARTITION BY EmployeeID) AS TotalCount,OrderID,CustomerID, EmployeeID,OrderDate FROM Orders (NOLOCK) ) SELECT OrderID,CustomerID, EmployeeID ,OrderDate,TotalCount From OrderInfo ORDER BY EmployeeID
WITH OrderInfo AS ( SELECT COUNT(OrderID) OVER() AS Count,OrderID,CustomerID, EmployeeID,OrderDate FROM Orders (NOLOCK) )
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有