1
select  EmbroiderAccountId, 
        EmbroiderReceivedDeliveryChallanId BuyerOrderProductId,
        EmbroiderDeliveryChallanNo, 
        EmbroiderName, 
        sum(Qty), 
        OrderNo, 
        Rate, 
        sum(Debit), 
        Credit, 
        EmbroiderReceivedChallanNo, 
        EmbroiderPaymentBillNo, 
        EmbroiderPaymentBillDate, 
        TransactionNaration
from dbo.EmbroiderAccount
group by EmbroiderReceivedChallanNo
Jaydip Jadhav
  • 12,179
  • 6
  • 24
  • 40
Manoj
  • 15
  • 3

1 Answers1

4

you need to group by all columns used in select query except those with aggregate function:

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
Jaydip Jadhav
  • 12,179
  • 6
  • 24
  • 40
Pawel
  • 56
  • 3