Linked Questions
21 questions linked to/from Dynamic pivot: sum of sales per month
2
votes
2
answers
63k
views
Convert Rows to columns using 'Pivot' in SQL Server when columns are string data type [duplicate]
I need to know whether 'pivot' in SQL Server can be used for converting rows to columns if there is no aggregate function to be used. I saw lot of examples with aggregate function only. My columns are ...
1
vote
3
answers
24k
views
How can I pivot a view into a join so I get multiple query rows as columns in a single row? [duplicate]
I have a view into which I am pulling properties of vehicles, such as tire size, engine capacity, color, number of doors, etc. This data is stored in multiple tables but I have simplified the data ...
1
vote
1
answer
15k
views
How to do a SELECT inside of a PIVOT [duplicate]
I am trying to SELECT values from a column in my database in order to perform a PIVOT on those values without hard-coding them.
SELECT *
FROM (SELECT ItemType, [Status] FROM [EVAULTTEST].[dbo]....
0
votes
2
answers
2k
views
Aggregate query on multiple values of same field [duplicate]
I am using SQL-Server 2012, I have a table of credit card transactions as follows:
CardScheme RespCode
=========================
Visa Declined
MasterCard Approved
MasterCard Approved
...
0
votes
1
answer
3k
views
T-SQL How to Pivot on the Values of a Table? [duplicate]
How do you pivot a table on the value in the field? I have to admit that while I can write some pretty nifty queries, have my CTEs down, and enjoy a wide knowledge of T-SQL programming, Pivots get ...
-1
votes
2
answers
362
views
How to merge a column in single row in sql server [duplicate]
I have a following data:
Comp_id | Cntm_nb | Seq_nb | Amount | Type
1 | 1 | 1 | 2000 | rent
1 | 1 | 1 | 200 | charge
1 | ...
1
vote
1
answer
2k
views
How can I count different types in a column in sql? [duplicate]
Data:
QID Type DOB
-------------
1 1 01/01/1980
1 2 03/01/1981
1 2 01/02/1991
1 1 01/01/1980
1 2 03/01/1981
...
2
votes
2
answers
886
views
Dynamic Pivot SQL table [duplicate]
Table dbsize loading with data of every database size every night.
dbsize (id, database_name, database_size, insert_date)
It looks like this:
- 1 dbname1 1000 1/1/1900
- 2 dbname2 2000 ...
0
votes
1
answer
922
views
Pivot Results By Day [duplicate]
I have a table in SQL Server 2008, with mails received from a pop account.
The table has the following columns:
+------+----+---------+------+------+
| from | to | subject | body | date |
+------+---...
0
votes
1
answer
883
views
Dynamic Pivot with overlapping years [duplicate]
I have looked and cannot find how to show the last # months in a pivot table. Everything I seem to run across codes months statically. I'm seeking a solution that shows something similar to the ...
0
votes
1
answer
655
views
SQL PIVOT multiple columns [duplicate]
so this:
so I need:
any suggestions?
0
votes
1
answer
436
views
Convert rows into columns using Pivot in SQL [duplicate]
I have this temp table named #DynamicDB, with below data.
Date Actual_Prod Forecast_Prod MRB_Parts
01-04-18 1 2 2
02-04-18 3 2 NULL
...
0
votes
1
answer
149
views
Show Rows as Columns in SQL Server [duplicate]
I havent worked with Pivot. Not sure if pivot is the right thing to use. Is it possible to show this data:
-------------------
| Name | Code |
-------------------
|Test A | 1 |
|Test B | ...
0
votes
0
answers
201
views
How to join these two tables without Foreign Key? [duplicate]
I want to generate monthly report and the total in a year based on position(jawatan) that has been applied.
Table 1 : tpermohonan (mohon_id pemohon_id mohon_tarikh mohon_online)
mohon_id
pemohon_id
...
-3
votes
1
answer
73
views
two columns in two rows [duplicate]
I have this table:
ID Value
-----------------
3 A1
4 A2
8 A20
10 A10
I have to create only ...