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

Jaydip Jadhav
- 12,179
- 6
- 24
- 40

Manoj
- 15
- 3
-
Seriously !!! mention your input and output more clearly. – Esty Oct 19 '16 at 11:07
-
http://stackoverflow.com/questions/2421388/using-group-by-on-multiple-columns – Mr. Bhosale Oct 19 '16 at 11:16
1 Answers
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