Angular 12 CRUD Example
In this article, we will learn angular 12 CRUD example with web API as well as way to implement cascading dropdown, searching, sorting, and pagination...
May 30, 2021 read moreIn this article, we will learn angular 12 CRUD example with web API as well as way to implement cascading dropdown, searching, sorting, and pagination...
May 30, 2021 read moreIn this article i am going to explain how you can use angular js table with bootstrap 4 in asp.net web form, and also show you how you can display records...
December 08, 2018 read moreCodingvila also allowing a guest post for digital marketing, where you can explore your business, product, or services in terms of articles. write quality.......
August, 21, 2021 read moreIn this article, we will learn how to create a bar chart in angular 12 using ng2-charts. Here, I'll explain how to create an angular 12 project in visual........
May 29, 2021 read moreThis article gives an explanation about convert Datatable to CSV in c# and explains the efficient way to write CSV files from Datatable as well as show...
March 01, 2020 read moreThis article provides an explanation about how to merge multiple pdf files into single pdf in using Itextsharp in c# here I also explained the use of Itextsharp.
January 22, 2019 read more![]() |
Figure: 1.0 |
DECLARE @TableSales AS TABLE ( ProductName VARCHAR(50), TotalSales FLOAT, YearName INT )
INSERT INTO @TableSales (ProductName,TotalSales,YearName) VALUES -- Total Sales in Year 2016 ('Shampoo' ,200010,2016), ('TV' ,300500,2016), ('AC' ,100054,2016), ('Fridge',3097540,2016), ('Washing Machine',289635,2016), ('Mobile',29600,2016), -- Total Sales in Year 2017 ('Shampoo' ,20440,2017), ('TV' ,963400,2017), ('AC' ,58963,2017), ('Fridge',475693,2017), ('Washing Machine',556936,2017), ('Mobile',90634,2017), -- Total Sales in Year 2018 ('Shampoo' ,95415,2018), ('TV' ,478952,2018), ('AC' ,225688,2018), ('Fridge',945630,2018), ('Washing Machine',796500,2018), ('Mobile',659803,2018), -- Total Sales in Year 2019 ('Shampoo' ,95415,2019), ('TV' ,478952,2019), ('AC' ,225688,2019), ('Fridge',945630,2019), ('Washing Machine',796500,2019), ('Mobile',659803,2019)
SELECT * FROM @TableSales ORDER BY ProductName
![]() |
Figure: 1.1 |
SELECT ProductName, [2016],[2017],[2018],[2019] FROM ( SELECT ProductName,TotalSales,YearName FROM @TableSales) TableSales PIVOT (SUM(TotalSales) FOR YearName IN ([2016],[2017],[2018],[2019])) AS pvt ORDER BY ProductName
![]() |
Figure: 1.2 |
NOTE: If using the PIVOT operator then you must need to use an aggregate function like MIN, MAX, COUNT, SUM and etc.
DECLARE @TableSales AS TABLE ( ProductName VARCHAR(50), [2016] FLOAT, [2017] FLOAT, [2018] FLOAT, [2019] FLOAT )
INSERT INTO @TableSales (ProductName,[2016],[2017],[2018],[2019]) VALUES ('AC',100054,58963,225688,225688), ('Fridge',3097540,475693,945630,945630), ('Mobile',29600,90634,659803,659803), ('Shampoo',200010,20440,95415,95415), ('TV',300500,963400,478952,478952), ('Washing Machine',289635,556936,796500,796500)
SELECT * FROM @TableSales ORDER BY ProductName
SELECT ProductName, TotalSales ,YearName FROM @TableSales UNPIVOT ( TotalSales FOR YearName in ([2016],[2017],[2018],[2019]) ) AS UnpivotSales
Codingvila provides articles and blogs on web and software development for beginners as well as free Academic projects for final year students in Asp.Net, MVC, C#, Vb.Net, SQL Server, Angular Js, Android, PHP, Java, Python, Desktop Software Application and etc.
Thank you for your valuable time, to read this article, If you like this article, please share this article and post your valuable comments.
Once, you post your comment, we will review your posted comment and publish it. It may take a time around 24 business working hours.
Sometimes I not able to give detailed level explanation for your questions or comments, if you want detailed explanation, your can mansion your contact email id along with your question or you can do select given checkbox "Notify me" the time of write comment. So we can drop mail to you.
If you have any questions regarding this article/blog you can contact us on info.codingvila@gmail.com
Tutup Konverter!sentiment_satisfied Emoticon