display pivot query in mvc

Posted by Klbaiju under ASP.NET MVC on 11/13/2014 | Points: 10 | Views : 472 | Status : [Member] | Replies : 0
Hi,following is my table with records

Cust Product QTY
KATE VEG 2
KATE SODA 6
KATE MILK 1
KATE BEER 12
FRED MILK 3
FRED BEER 24
KATE VEG 3

if run following pivot query

SELECT PRODUCT, FRED, KATE
FROM (
SELECT CUST, PRODUCT, QTY
FROM Products) up
PIVOT (SUM(QTY) FOR CUST IN (FRED, KATE)) AS pvt
ORDER BY PRODUCT

i got following result

PRODUCT FRED KATE
----------------------
BEER 24 12
MILK 3 1
SODA NULL 6
VEG NULL 5

my requirement is to display the records from pivot query in a view in mvc application

how it is possible.

Regards

Baiju




Responses

(No response found.)

Login to post response