SELECT
a.[Id] as1,
a.[Version] as2,
a.[IsDeleted] as3,
a.[CreatedUserId] as4,
a.[CreatedUserName] as5,
a.[CreatedTime] as6,
a.[ModifiedUserId] as7,
a.[ModifiedUserName] as8,
a.[ModifiedTime] as9,
a.[ItemNo] as10,
a.[ItemName] as11,
a.[HandItemName] as12,
a.[ItemType] as13,
a.[ProjectName] as14,
a.[ProjectType] as15,
a.[ProviderName] as16,
a.[ItemCompanyName] as17,
a.[PriceDate] as18,
a.[Status] as19,
a.[ItemDescription] as20,
a.[HandItemDescription] as21,
a.[ItemUnit] as22,
a.[ItemQuantity] as23,
a.[CostAAmount] as24,
a.[CostBAmount] as25,
a.[CostCAmount] as26,
a.[MangerAmount] as27,
a.[ProfitAmount] as28,
a.[ComPrehenSiveAmount] as29,
a.[TaxAmount] as30,
a.[SumAmount] as31,
a.[Remark] as32
FROM
(
SELECT
a.[Id],
a.[Version],
a.[IsDeleted],
a.[CreatedUserId],
a.[CreatedUserName],
a.[CreatedTime],
a.[ModifiedUserId],
a.[ModifiedUserName],
a.[ModifiedTime],
a.[ItemNo],
a.[ItemName],
a.[HandItemName],
a.[ItemType],
a.[ProjectName],
a.[ProjectType],
a.[ProviderName],
a.[ItemCompanyName],
a.[PriceDate],
a.[Status],
a.[ItemDescription],
a.[HandItemDescription],
a.[ItemUnit],
a.[ItemQuantity],
a.[CostAAmount],
a.[CostBAmount],
a.[CostCAmount],
a.[MangerAmount],
a.[ProfitAmount],
a.[ComPrehenSiveAmount],
a.[TaxAmount],
a.[SumAmount],
a.[Remark],
row_number ( ) OVER ( partition BY a.[ItemNo], a.[ItemCompanyName], a.[ProviderName] ORDER BY a.[ComPrehenSiveAmount] ) [rownum]
FROM
[ad_item_foreign] a
WHERE
( ( a.[ProjectName] = N'洋房工程' ) )
AND (a.[Status] = 0) AND (a.[PriceDate] >= '2022-10-01 00:00:00.000'
AND a.[PriceDate] < '2022-10-30 00:00:00.000')
AND ( ( a.[HandItemName] = N'技术措施项目费' ) )
AND ( ( a.[HandItemDescription] = N'技术措施项目费包括但不限于大中型机械进退场及安拆费塔吊及施工电梯基础除桩基外垂直运输及超高降效施工排水及降水泵送增加费构件运输及安装等其所有相关施工枝术措施费用按建筑面积计算' ) )
AND ( a.[IsDeleted] = 0 )
) a
WHERE
( a.[rownum] = 1 )
标签:PriceDate,函数,ProjectName,00,ComPrehenSiveAmount,开窗,sqlSever,ItemCompanyName,IsDe From: https://blog.51cto.com/jition/5812295