Click here to Skip to main content
15,881,709 members
Everything / Pivot table

Pivot table

pivot-table

Great Reads

by yuvalsol
Create professional-looking Excels (Filters, Charts, Pivot Tables) with EPPlus
by Gaurav_Chaudhary
This tip is a brief introduction to Pivot operator in SQL Server
by Sifiso W Ndlovu
This tip illustrates a workaround to SQL Server pivoting on variable character data types.
by B. Clay Shannon
The most straightforward way to add a Pivot Table to an Excel sheet based on data already on the sheet, using Excel Interop and C#

Latest Articles

by yuvalsol
Create professional-looking Excels (Filters, Charts, Pivot Tables) with EPPlus
by B. Clay Shannon
The most straightforward way to add a Pivot Table to an Excel sheet based on data already on the sheet, using Excel Interop and C#
by Sifiso W Ndlovu
This tip illustrates a workaround to SQL Server pivoting on variable character data types.
by Gaurav_Chaudhary
This tip is a brief introduction to Pivot operator in SQL Server

All Articles

Sort by Score

Pivot table 

23 May 2018 by yuvalsol
Create professional-looking Excels (Filters, Charts, Pivot Tables) with EPPlus
7 Feb 2015 by Gaurav_Chaudhary
This tip is a brief introduction to Pivot operator in SQL Server
30 Aug 2013 by Nelek
Since you didn't ask any question, it is difficult to give you a better answer.I strongly recommend you to read: How to ask a question[^] and What have you tried?[^]P.S. Written as solution to avoid this "question" to be in the unanswered list
7 Mar 2014 by CHill60
As per RyanDev's suggestion I'm posting this solution ...BulletVictim[^] said Quote:try two ' around the @fin_year(''+@fin_year+''))I responded Quote:Your error is in @sql. Can you post the output from the PRINT @sql command. BulletVictim is correct - you appear to missing single quotes...
22 Feb 2016 by Sifiso W Ndlovu
This tip illustrates a workaround to SQL Server pivoting on variable character data types.
27 Feb 2020 by Maciej Los
You need to use ORDER BY clause[^]. SELECT * FROM ( SELECT CurrCode, YEARNO, Monthno, TOTALAMOUNT FROM [dbo].[ML_tbl_Analaysis] where Currcode =@CURRCODE ) tbl PIVOT (sum(TOTALAMOUNT) FOR [yearno] IN...
4 Jun 2020 by #realJSOP
What you want to do is perform a "pivot" on your table. If you're doing in it in a MySQL Server view or stored proc, SQL Pivot in all databases: MySQL, MariaDB, SQLite, PostgreSQL, Oracle, …[^]
11 Dec 2012 by farey2000
Regards,I have a table as below:create table #t (Factura varchar(15),ReciboCaja varchar(15),ReciboCajaValor varchar(15),)insert into #t values('1', '1', '1')insert into #t values('1', '2', '2')insert into #t values('1', '3', '3')insert into #t values('2', '4',...
1 Jan 2013 by Aarti Meswania
I have data like below...data rowno colno---------------abc 1 112 1 2xyz 2 189 2 2now I want Outputcol1 col2------------abc 12xyz 89 How can i do this using pivot or any other way?please help :)
2 Jan 2013 by Aarti Meswania
I have solved ithope it will useful to them having same problemselect [1] as col1, [2] as col2 from tblPIVOT( max(data) FOR colno IN ( [1],[2] )) PivotTableHappy coding!:)
2 Jan 2013 by Herman<T>.Instance
Read my article about dynamic pivotting here[^]
2 Jan 2013 by __TR__
Here is an approach without using PivotDECLARE @T TABLE (data VARCHAR(50), rowno INT, colno INT)---------------INSERT INTO @TSELECT 'abc', 1, 1 UNION ALLSELECT '12', 1, 2 UNION ALLSELECT 'xyz', 2, 1 UNION ALLSELECT '89', 2, 2--SELECT data, RowNo, ColNo FROM @TSELECT Col1,...
27 Aug 2013 by Raja Sekhar S
Try this...Declare @idoc int, @doc varchar(1000) Set @doc =''Set @doc =Replace(@doc,'\','') -- @doc value will be EXEC sp_xml_preparedocument @idoc OUTPUT,...
1 Apr 2014 by Maciej Los
Please, see my comment to the question.Try it:SELECT userid, [IN], [OUT]FROM ( SELECT * FROM access_event_logs ) AS DTPIVOT(MAX(timestamps) FOR eventid IN ([IN],[OUT])) AS PTIf [total] means the difference in hours, try it:SELECT userid, [IN], [OUT],...
28 Apr 2014 by Maciej Los
Change it to:SELECT VisitID, VisitDate, IssuedBy, VisitPurpose, CompanyName, SPname as 'SalePerson', [1] as 'Person 1', [2] as 'Person 2', [3] as 'Person 3'FROM (SELECT VisitID, VisitDate, IssuedBy, VisitPurpose, CompanyName, SPname, [1], [2], [3] FROM ( SELECT TD.VisitID,...
1 May 2014 by Andrius Leonavicius
Maciej is right. PIVOT does the job.Here's the dynamic SQL version:DECLARE @ColumnsTable TABLE (col VARCHAR(10)); INSERT INTO @ColumnsTable (col)SELECT DISTINCT cidFROM src_table; DECLARE @Columns VARCHAR(MAX), @SQL VARCHAR(MAX); SET @Columns = (SELECT STUFF((SELECT...
14 Jun 2015 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Perfectly works for me. See the SQLFiddle - http://sqlfiddle.com/#!3/b82c6/1/0[^].
7 Sep 2015 by Animesh Datta
Hello ,Refer :SQL - Pivot with Grand Total Column and Row
7 Sep 2015 by Maciej Los
The logic is: SELECT T.*, ([2015-08-01] + [2015-08-02] + [2015-08-03]) AS TotalFROM (-- your dynamic query) AS Twhere [2015-08-01] + [2015-08-02] + [2015-08-03] commes from @columns variable ;)Get it?
5 Oct 2016 by Maciej Los
There's few ways to achieve that:1) using ExcelCreate a PivotTable to analyze external data - Excel[^]Excel - Create a Pivot Table Using SQL - Spreadsheets Made Easy[^]Create Excel Pivot Table from SQL Server | Go Beyond Excel[^]2) using C#Creating a PivotTable Programmatically –...
29 Mar 2020 by Maciej Los
Yes, it is possible to achieve that on squery level. See: Using PIVOT and UNPIVOT - SQL Server | Microsoft Docs[^] Then... in c#: 1. Open SqlConnection[^] 2. Create SqlCommand[^] (with pivot query) 3. Create SqlDataReader[^] by calling...
5 Jun 2020 by Member 14852988
Hello, sorry for the wrong posting. I tried the hole day and I think I found what I am looking for. SELECT id, name, team, MAX(CASE WHEN datum = DATE_SUB(CURDATE(), INTERVAL 4 day) THEN points END) 4tage, ...
4 Jan 2023 by CHill60
Another alternative is to create a pivot table with "Step" in the Columns selection, "Order" in the Rows selection and "Count of Step" in the Values selection. On my sample the pivot table is in columns F to K, rows 1 to 5 and looks like this ...
23 Feb 2012 by Dharmenrda Kumar Singh
I Have an Excel Sheet where i had created an pivot table which is taking data from Sql Table.I am downloading that Excel sheet from an Application to Client machine and when we try to open it in clint machine, it is asking for the SQl Server Login Credentials.Is there any way so that after...
23 Feb 2012 by Dharmenrda Kumar Singh
I had solved by doing some manipulation .1. Create a user in SQl Server and give permission to that user for the desired database.2. Open Excel->Click on "Data" Tab3. Click on Existing Connection.A pop up will appear.4. On the top of the pop up wimdow, you find "Connections in this...
16 Mar 2012 by Enkinger
Hi,I have DB in Sql. I want to show this results in gridview ( or similar something)Datagirdview shown us like excel pivot table. ( example is below)Every result is will be coming in sql DB.( We dont know Rowcount or column count or row and Column Name. İt is changing according to DB....
17 Mar 2012 by Herman<T>.Instance
Hey Enkinger,read my article[^] about dynamic pivots in sql
20 Mar 2012 by Member 7851700
I've spent significant amount of time looking around, however couldn't really find any solution to this:I've got 4 tables: Category(id,Name),Product(id,Name,CategoryID),RatedProducts(id,Rating,ProductID,UserID), User(id,Name) Category1 Category2 ...
21 Mar 2012 by Member 7851700
Thanks, var result = from r in smdt.SM_RatedProducts group r by new { r.SM_Product.Name, UserName = r.SM_User.Name, Category = r.SM_Product.SM_Category.Name, r.Rating } into prodGroup orderby prodGroup.Key.UserName ascending orderby...
2 Apr 2012 by Member 7851700
Gents, I'm trying to create a dynamic pivot gridview table capable of updating on the fly. I managed to populate the whole lot from my DB but what do I do if I want the user to have a number of dropdowns/textboxes so they can narrow down the result. EDIT:_dtProjects =...
26 Jun 2012 by JakirBB
I have a table with data as follows.Name Size----------------A 1B 2C 1D 1E 3F 2I have to write an SQL (sql server) which will return 3(as there are 3 types of sizes are in the table) tables. The number of produced...
26 Jun 2012 by Tim Corey
If you want three resultsets, then the answer is no. You would need a loop to do that (unless you hard-coded the statements, which would be worse). However, I don't see the business case for doing something like this. I would recommend returning one resultset and then break it apart in code...
28 Oct 2012 by sruthyharidas
I am Having a Result Set Like ThisItemCode Value1 Value2 Value3 Value4Item1 1 2 3 4Item2 5 6 7 8Item3 9 10 11 12I need to convert this table to following formatItem1 Item2 ...
29 Oct 2012 by BK 4 code
select * from (select ItemCode,Value1 from tbl_test) AS SourceTablePIVOT( max(Value1)FOR ItemCode IN ([Item1],[Item2],[Item3])) AS PivotTableUnionselect * from (select ItemCode,Value2 from tbl_test) AS SourceTablePIVOT( max(Value2)FOR ItemCode IN...
30 Oct 2012 by V Mohan
Hi,I have a table structure like below Date PID BUID UID Description Time 7/30/2012 323 1 106 Code 957/30/2012 322 37 106 Code 37/30/2012 NULL 1 106 Huddle 17/30/2012 NULL 1 106 Team...
30 Oct 2012 by Maciej Los
lease, have a look at below example:CREATE TABLE #MyTable(mDate DATETIME, mPID INT, mBUID INT, mUID INT, mDescription NVARCHAR(30), mTime INT)INSERT INTO #MyTable (mDate, mPID, mBUID, mUID, mDescription, mTime)VALUES('7/30/2012', 323, 1, 106, 'Code', 95)INSERT INTO #MyTable (mDate,...
7 Nov 2012 by sayedalishakeel
Hi All,Need to pivot the given data Key colName ColVal8213392 CallSign 1a2348213392 Date 1a2348308862 CallSign A8KD48308862 Date 21-Sep-068322662 CallSign 1a2348322662 Date 1a2349015905 CallSign 1a2349015905 Date 1a234The...
11 Dec 2012 by Herman<T>.Instance
read my article here[^] on CodeProject.Has explanation, samples etc.
20 Dec 2012 by DinhCongLoc
Dear all,Please help me to resolve an issue for PivotTables such as:1. I have 2 PivotTable as: PVT1 in Sheet1, PVT2 in Sheet22. These PivotTable have same source and same Filter (Year, Quater).3. I would when i change Filter in PVT1, Filter of PVT2 is changed automaticallyPlease...
20 Dec 2012 by DinhCongLoc
Dear all,- I have sheet contain data as "DATA"- I have PivotTable (PVT1) from "DATA" with:+ Filter: Year, Quater+ Colume: Month+ Row: Location+ Value: Money- I also have PivotTable (PVT2) from "DATA" with:+ Filter: Year, Quater+ Colume: Location+ Row: Month+ Value:...
17 Mar 2013 by Maideen Abdul Kader
My Problem:my store procedure have dynamic column. so i cannot insert into tabe.so i need to export directly to excel. Below is my code. Below code is working fine.i need either export excel directly from store procedure or how can i create dynamic table with store procedurePls help...
17 Mar 2013 by Prasad Khandekar
Hello,I will suggest that let this stored procedure return a resultset and use it to create an Excel file. Simplest way will be create a CSV file. Here[^] is some code to get you started.Regards,
24 Mar 2013 by Anoop Jasiwal
select ID,oldid,[newid] from table1 as adp join table2 as CLN on cln.oldid = adp.id2or CLN.oldid = adp.IDID oldid newid2 1 1962 41 236i need the above tables with pivoting values as below,ID oldid newid oldid2 newid22 1 196 41 236can someone help in writing the...
4 Apr 2013 by MK-Gii
Hello Guys :)I got another issue with C# - I am looking for a way of collapsing pivot table fields. Generally situation is as follows:http://i45.tinypic.com/cnx37.jpg[^]I know that in VBA it can be done by this peace of...
4 Apr 2013 by Kenneth Haugland
Since you gave the VBA code im going to assume that it can be done this way: Excel.Application oXL; Excel._Workbook oWB; Excel._Worksheet oSheet; Excel.Range oRng; try { //Start Excel and get Application object. oXL = new Excel.Application(); oXL.Visible =...
18 Jun 2013 by djapb
Hello all,I hope somebody may be able to help me with my problem. In a nutshell I am required to develop a Pivot / Cross Table Style Data Input Form. The description above might be enough for a response but if not i have tried to explain the problem in detail below. The Tables in...
19 Jun 2013 by MohamedKamalPharm
take a look on this article, my helpSimple Way To Use Pivot In SQL Query
12 Jul 2013 by chimcham
This may not be the best answer but at least you can get an idea on how to work onyour report, and not using pivot.SELECT A.[Category], isnull(SUM([JANUARY]),'') as [JANUARY], isnull(SUM([FEBRUARY]),'') as [FEBRUARY], isnull(SUM([MARCH]),'') as [MARCH], ...
13 Jul 2013 by Hammad Raza
SELECT er.category `Category`, SUM(IF(transactionDate between '2013-01-01' and '2013-01-31', r.totalamount, 0)) Jan, SUM(IF(transactionDate between '2013-02-01' and '2013-02-31', r.totalamount, 0)) Feb, SUM(IF(transactionDate between '2013-03-01' and '2013-03-31', r.totalamount, 0))...
27 Aug 2013 by iCanDivideByZero
Does anyone know how to convert the following into a table: This is results is yielded from executing a stored procedure (EXEC [dbo].[sp_GetSomeData] +@DataID+ FOR XML RAW) and I want to take the results produced and put it into a...
30 Aug 2013 by phil.o
I would add to the first (perfectly valid) solution of Nelek this link :SQL pivot table[^]which will lead you to about 762,000 results on this topic.Good reading!
18 Nov 2013 by Maciej Los
Meluzin (Tomas) wrote:(...) the application is an MS excel Add-in and should be able to create the pivot table on the data which is read from backend system. So the process is following:* firstly data is read from backend system (based on user's selection)* at runtime, I create the MS Access...
24 Nov 2013 by Meluzin
So finally, rewritting the code into ADO helped.Here is the ADO coding.Firstly, Access DB is created. There is one trouble with this - simple ADO cannot do this, therefore, you have to use additional extension component ADOX (Microsoft ADO Ext. x.x for DDL and Security) - more details...
13 Feb 2014 by GauravThorat
Hi all,I wanted to Call Stored Procedure using Entity Framework,SP is using Pivot and #Temp table and returning distinct and different columns run time.Now the problem here is, when I am adding SP as using Function Import, and clicking on Get Column Information it is giving me "The...
13 Feb 2014 by CoderPanda
This[^] should help. [Please accept/up-vote answers or solutions that work for you to encourage others]
13 Feb 2014 by joginder-banger
try this linkhttp://stackoverflow.com/questions/209383/select-columns-from-result-set-of-stored-procedure?rq=1[^]
13 Feb 2014 by GauravThorat
I have set all Adhoc query Options and called the required sp in another sp like SELECT *FROM OPENQUERY([Server], 'SET NOCOUNT ON; EXEC [DB].[dbo].SP ''33''')Now I wanted to get pass the 33 which through parameter like SELECT *FROM OPENQUERY([Server], 'SET...
5 Mar 2014 by Sateesh Pasupulla
This is stored procedure with pivot table to generate data like thisజిల్లా 2007-2008 2008-2009 2009-2010 2010-2011 2011-2012Chittoor 14000 12000 15500 2376 3425Total 14000 12000 15500 55236 436346while executing i am getting this errorUnclosed...
6 Mar 2014 by sachi Dash
Firstly I get a dataset through a query from database.then i convert this dataset into Json string.By using ajaxcall i get this Json string in my clint side.Now I need to prepare this string through javascript in my clint side.Then I will show this string in a pivot table?I...
9 Mar 2014 by Maciej Los
If you don't want use SQL pivot[^], i'd suggest to use Linq[^].LINQ Pivot, or Crosstab, Extension Method[^]Pivot table in LinQ to entity[^]Is it possible to Pivot data using LINQ?[^]
1 Apr 2014 by akhil.krish
my (access_event_logs) table[USERID] [TIMESTAMPS] [EVENTID]1 019 2014-03-06 07:50:48.000 IN 2 019 2014-03-06 17:02:39.000 OUT3 019 2014-03-09 07:43:37.000 IN 4 019 2014-03-09 14:34:59.000 OUT 5 019 2014-03-10 07:43:34.000 IN...
6 Apr 2014 by akhil.krish
this query give intime and outtime but i want total time and late time aslo....select distinct CE.USERID, CONVERT(Date,Localtimestamp) as LocalTime,(select min(TIMESTAMPS) from access_event_logs As MINCEwhere CAST(MINCE.TIMESTAMPS as DATE)=CAST(CE.TIMESTAMPS As DATE) AND...
7 Apr 2014 by Bh@gyesh
Hi,Plase refer following link.Simple Way To Use Pivot In SQL Query[^]
7 Apr 2014 by ArunRajendra
Found few links. There are lot more if you google using "pivot in sql server 2012...
10 Apr 2014 by Tomas Takac
I didn't understand much from what you have written, but here is the query that gives the desired output. I like to work in steps using CTEs.declare @intime time = '8:30'declare @outtime time = '14:30';with dates as( select cast([TIMESTAMPS] as date) as [date], * from...
28 Apr 2014 by chaau
The problem is that you need to make sure that there is at least one record in your tblVisitTicket table for this query to work. If there are none the subquery you use for PIVOT source will return zero rows. The best way to fix it is to LEFT JOIN it with a fake numbers table that will contain...
1 May 2014 by Maciej Los
Pivot should works perfect! Static version:SELECT Trm_id, agt_id, nk_id, cid_10, cid_11, cid_12FROM ( SELECT t1.Trm_id, t1.agt_id, t1.nk_id, t1.cid, 'cid_' + CONVERT(VARCHAR(10),t1.cid) AS ColHeader, t1.valueid, t2.value_desc FROM src_table AS t1 INNER JOIN reference_table AS t2 ON...
18 Aug 2014 by jayeshhh
I have a table Structure Like this :EdpNo FullName PeriodMonth ITaxAmount EduCess 16 RAJ KISHORE SHAW 4 1809 5416 RAJ KISHORE SHAW 5 1812 5416 RAJ KISHORE SHAW 6 3185 9516 RAJ KISHORE SHAW 7 0 016 RAJ KISHORE SHAW 8 0 016 RAJ...
18 Aug 2014 by Magic Wonder
Hi,Check this...Simple Way To Use Pivot In SQL Query[^]Hope this will help you.Cheers
14 Sep 2014 by Member 11031380
I have a ListView (or GridView) draft table like this:https://www.dropbox.com/s/dnvwjx79kfrsq44/01.JPG?dl=0[^].JPG?dl=0">https://www.dropbox.com/s/dnvwjx79kfrsq44/01.JPG?dl=0[^]My SQL Server table has the following fields:- UPC (bigint)- Description (varchar)-...
7 Oct 2014 by DungVanNguyen
My table tblEmployeeScan(EMPLOYEE_ID varchar(7), ScannedTime)Everyday each employee scans 2 times, 1 time or 0 timeNow I want to crate store procedure Create proc spMonthScanReport@MONTH int,@YEAR intwhich returns a mothly report like belowEMPLOYEE ID 1 ...
7 Oct 2014 by Maciej Los
Please, read my comment to the question.You need dynamic pivot which generates as many column as many days is in a month:Dynamic PIVOT in Sql Server[^]pivots with dynamic columns in sql server 2005/[^]Script to create dynamic PIVOT queries in SQL Server[^]Use SearchBox on the...
7 Oct 2014 by Dharmendra Kumar Jain
Create Procedure spMonthScanReport (@Minth int, @Years int)asselect EMP_ID, [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], ...
6 Nov 2014 by Maciej Los
I'd like to say that you're able to achieve almost the same functionality what Excel does have. Let's say, you need to create editable gridview. That's all!It's bad idea to use third party application (like Excel), because of many factors:1) you can't (fully) control it,2) you need to...
20 Nov 2014 by Member 9129971
I am using asp.net mvc 5,entity frmework 5, linqi have following tables:order: 1. orderid customerid 1 2 2 3 3 1orderDetail: orderid productname quantity 1 A ...
20 Nov 2014 by /\jmot
9 Apr 2015 by sambasiva.g
ID ColumnName ColumnValue Deal...
9 Apr 2015 by Maciej Los
Here is an idea: PIVOT and UNPIVOT[^]Simple Way To Use Pivot In SQL Query[^]Pivot tables in SQL Server. A simple sample.[^]PIVOT and UNPIVOT in Sql Server[^]
13 Jun 2015 by Kunal Ved
I get this error when I use Pivot operator Msg 102, Level 15, State 1, Line 3Incorrect syntax near '('.CREATE TABLE BookSalesTable(BookType VARCHAR(20), SalesYear INT, BookSales Int);SELECT *FROM BookSalesTable PIVOT (SUM(BookSales) FOR SalesYear IN([2013], [2014]) ...
29 Jun 2015 by Maciej Los
This functionality is available starting from Excel 2010. See: Overview of PivotTable and PivotChart reports[^]
28 Jul 2015 by Avinash1310
SELECT meterid,transdatetime,[8] as [8 - 9],[9] as [9 - 10],[10] as [10 - 11],[11] as [11 - 12],[12] as [12 - 1],[13]as[1 - 2],[14]as[2 - 3],[15]as[3 - 4],[16]as[4 - 5],[17]as[5 - 6],[18]as[6 - 7],[19]as[7 - 8],[20]as[8 - 9] FROM(SELECT meterid, CONVERT(VARCHAR(10),...
14 Aug 2015 by Member 11898509
Solution is-create or replace procedure test_studentsascursor c_colsisselect column_namefrom user_tab_columnswhere table_name = 'STUDENTSENROLL'and column_name != 'STUDENTS';l_number_of_students number;l_my_col user_tab_columns.column_name%type;l_statement...
24 Nov 2016 by munirshaikh
I have a Dynamic PIVOT query in which Columns are dynamically generated.My table: ATTENDANCE_MASTER Contains: ID, Stud_id, ATT_DATE, PRESENTwhich stores data like:ID Stud_id ATT_DATE PRESENT1 1 2015-08-1 12 2 2015-08-1 03 3 2015-08-1 14 ...
14 Sep 2015 by Leo Chapiro
Yes, it is possible, take a look at How to View and Analyze an OLAP Data Cube with Excel :Quote:To view and analyze an OLAP data cube with Excel 1. In the Service Manager console, click Data Warehouse, expand the Data Warehouse node, and then click Cubes. 2. In the Cubes pane,...
22 Apr 2016 by Member 12464468
Dear experts,Could anybody advise me how to create a pivot table in Excel using C++ (not using MFC or #import)? In particular, how Range should be defined to be properly passed into IDispatch::invoke(...) function on a stage of PivotCach object creation? In VB it looks like: Dim...
2 May 2019 by Member 12658789
USE AdventureWorks2014;SELECT *FROM( SELECT VendorID, EmployeeID FROM Purchasing.PurchaseOrderHeader) AS PURPIVOT( COUNT(EmployeeID) FOR EmployeeID IN ("250", "251", "256", "257", "260")) AS PVTWhat I have tried:I'm not sure what to try as I'm very new to SQL.
28 Jul 2016 by Patrice T
You should really read the web pages where you found your sample code.SQL Aliases[^]PIVOT and UNPIVOT in Sql Server | SqlHints.com[^]Using PIVOT and UNPIVOT[^]
5 Oct 2016 by #realJSOP
I found this article on CodeProject (you could have found it if you had performed your own google search for the phrase, "C# pivot table"):C# Pivot Table[^]
30 Nov 2017 by Member 13264296
As we know that the record will stored to the database if there is a transaction on that date. But if there is certain date that we had no transactions, No date of transactions will be keep on record to the database. Now, I will make a report, I need to display the dates including no...
30 Nov 2017 by CHill60
I usually do this by generating a list of the dates that I need (see Generating a Sequence in SQL[^] ) and then using that table in a LEFT JOIN to my actual data table. E.g. SELECT ....-- column list FROM MyListOfDates D LEFT OUTER JOIN biometricdata A ON D.DesiredDate = A.[DATE] -- or whatever...
17 May 2018 by Richard MacCutchan
See Microsoft.Office.Interop.Excel namespace ()[^].
2 Nov 2018 by Member 14041654
I'm getting output for pivot xml as 2018-10-291252018-10-30122018-10-311 ...
6 Dec 2018 by Member 14080105
I have an Excel sheet that has a pivot table in it. This pivot table pulls its data from a table that I have no other access to. I need to upload this data into a MySQL table on a daily basis. The part that will take the pivot table and upload it to MySQL works perfectly. The problem is that...
2 May 2019 by akash_95
I want to add an extend to this question. Let's say there is a table which will map the column names with actual names eg. in this case. 250 | emp1 | 251 | emp2 | 251 | Johny | 252 | Harry | and so on. And the column names should be (emp1,emp2,John,...) and not (250,251,252,....). Is there...
27 Feb 2020 by Maideen Abdul Kader
Hi I have an issue that I could not sort/order by Month or monthno in pivot. Please advice me Thank you Maideen here is my code What I have tried: SELECT * FROM (SELECT CurrCode,YEARNO,Monthno,TOTALAMOUNT FROM [dbo].[ML_tbl_Analaysis]...
29 Mar 2020 by smodak@ats360.com
Hi, I wanted to implement the excel like pivot table functionality using SQL query. Is there any technical approach to achieve this functionality on the query level? Also is it possible to implement using C#.net code? Thanks What I have tried:...
5 Jun 2020 by Member 14852988
Hello, I have a uestion regarding my SQL Code. My goal is it to switch rows to columns. ID | NAME | POINTS| DATE ----------------------------------- 1 | KARL | 2 | 2020-05-15 2 | EVA | 0 | 2020-05-15 3 | OTTO | 5 | 2020-05-15 4 | KARL | 3 |...
12 Oct 2020 by houssem eddine ayari
Hello, I tried to make an excel PivotTable with C# windowsForm. I need to get data from SqlServer but nothing is written on my Excel file. What I have tried: private void button2_Click(object sender, EventArgs e) { string...
4 Jan 2023 by Cody O'Meara
Hello! This is sort of hard to explain but I basically want Orders summarized to one row then move the step column to their own cells following the unique order number to form a single row. Here is an example to visually show it: Example Data: ...