gpt4 book ai didi

c# - sql分组依据的使用方法

转载 作者:太空宇宙 更新时间:2023-11-03 21:07:42 25 4
gpt4 key购买 nike

select  EmbroiderAccountId, 
EmbroiderReceivedDeliveryChallanId BuyerOrderProductId,
EmbroiderDeliveryChallanNo,
EmbroiderName,
sum(Qty),
OrderNo,
Rate,
sum(Debit),
Credit,
EmbroiderReceivedChallanNo,
EmbroiderPaymentBillNo,
EmbroiderPaymentBillDate,
TransactionNaration
from dbo.EmbroiderAccount
group by EmbroiderReceivedChallanNo

最佳答案

您需要按 select 查询中使用的所有列进行分组,但具有聚合函数的列除外:

SELECT EmbroiderAccountId
,EmbroiderReceivedDeliveryChallanId BuyerOrderProductId
,EmbroiderDeliveryChallanNo
,EmbroiderName
,sum(Qty)
,OrderNo
,Rate
,sum(Debit)
,Credit
,EmbroiderReceivedChallanNo
,EmbroiderPaymentBillNo
,EmbroiderPaymentBillDate
,TransactionNaration
FROM dbo.EmbroiderAccount
GROUP BY EmbroiderAccountId
,EmbroiderReceivedDeliveryChallanId
,EmbroiderDeliveryChallanNo
,EmbroiderName
,OrderNo
,Rate
,Credit
,EmbroiderReceivedChallanNo
,EmbroiderPaymentBillNo
,EmbroiderPaymentBillDate
,TransactionNaration

关于c# - sql分组依据的使用方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40129635/

25 4 0
文章推荐: c# - List 到层次结构