We are providing online training of realtime Live project on Asp.Net MVC with Angular and Web API. For more information click here. If you have any query then drop the messase in CONTACT FORM

Friday, August 14, 2015

create table product
(
Productid int primary key,
category varchar(20),
price int
)
insert into product values(1111,'Computers',5000),
                              (2222,'Electrical',4500),
         (3333,'Electronics',4800),
         (4444,'Mechanical',4300)
select * from product

SELECT Computers,Electrical,Electronics,Mechanical
FROM (
  SELECT price, Category FROM product
) product
PIVOT (
  MAX(Price) FOR Category IN (Computers,Electrical,Electronics,Mechanical)
) Result;


   
Output:  



No comments: