1

In SQL Server, we are getting the result as shown here:

Image1

But, we need the output as shown here:

enter image description here

Is there any way we can merge the duplicate data through asp.net front-end or through SQL Query / Stored procedure?

Abhijeetchindhe
  • 400
  • 2
  • 15

2 Answers2

0

It may not be the preferred solution but it may help you to get data in more appropiate way:

SELECT * FROM [{yourDb}].[dbo].[{yourTb}] ORDER BY ProductName ASC
COMPUTE sum(Quantity) BY ProductName 

Result : Item OrderId Quantity

Banana 31 2

Sum 6

-- continued

Item OrderId Quantity

Apple 33 5

Sum 21

Mohit Pandey
  • 3,679
  • 7
  • 26
  • 38
0

You can return two tables from stored procedure , one table is having only product detail with total field and another one is having order detail.

Put grid with inner grid.

Now bind parent grid with product table and 2nd grid with order table, it will solve your problem.

Hiral
  • 465
  • 3
  • 12