Questions tagged [pivot-without-aggregate]

Pivot a table that has no numeric values that can be used to aggregate its columns with.

Pivot a table that has no numeric values that can be used to aggregate its columns with.

30 questions
1
vote
2 answers

how to transform vertical fields in a table to horizontal result by SQL

I have a table like this: create table t1 { person_id int, item_name varchar(30), item_value varchar(100) }; Suppose person_id+item_name is the composite key, now I have some data (5 records) in table t1 as below: person_id ====item_name…
wureka
  • 731
  • 1
  • 11
  • 26
1
vote
2 answers

Select query by type wise

Table1 Code, desc, type id 01 Rajan 1 01 Sajan 1 01 Vijayan 2 01 Suresh 3 01 Caresh 4 01 Sujesh 4 01 vikran 4 02 desk 1 02 card 2 02 villa 2 02 megash 2 02 supan 3 .... I want to…
Gopal
  • 11,712
  • 52
  • 154
  • 229
1
vote
1 answer

SQL Query to Grid from Multiple Tables

I am trying to write a query to display to a data control. I'm having some issues trying to get the query I need. I want the grid to to display: product name dealer 1 dealer 2 dealer 3 dealer 4, etc
product a 10 …
kylemac
  • 189
  • 4
  • 19
1
vote
3 answers

Help needed in data pivoting without aggregate in sqlserver 2008

I need to pivot a table as follows : the initial table is like this GEO PRD PACK DATATYPE Sales1 Sales2 T1 P1 M1 22 1 2 T1 P1 M1 23 2 8 T1 P1 M1 24 3 5 T2 P2 M2 22 3 2 T2 …
1
vote
2 answers

SQL PIVOT(?) query

I have spent a full day on this and just don't get it. Usually I am pretty good with this stuff but I am just getting back in to SQL and just cannot figure this out. Any help you can provide would be very much appreciated. I am running SQL Server…
1
vote
1 answer

How to create a PIVOT TABLE without summing a column

Here is my query CREATE view pivmehis WITH ENCRYPTION as SELECT APPROVED, [Not Approved] as REJECT, NULL FROM (SELECT MgtApproval from LeaveRequest) l PIVOT ( Sum (SchedId) --I DON'T WANT TO SUM THIS COLUMN FOR MgtApproval IN ([APPROVED],…
Yves
  • 12,059
  • 15
  • 53
  • 57
1
vote
1 answer

Remove null columns from Pivot tsql

I developed a pivot in tsql which resembles below: MaturityBand AAA AA+ AA AA- A+ A A- Grand_Total Less than 1 yr NULL NULL NULL NULL NULL NULL 7.92 7.92 1 to 5 yrs NULL NULL 0.44…
chrissy p
  • 823
  • 2
  • 20
  • 46
1
vote
2 answers

Multiple rows into single row with header name

My problem is like this question but I am fetching data from different table: Name ID Subject-name obtained-marks gumman 9 English 3 gumman 9 Islamic-Studies 4 gumman 9 Pak Studies 3 I want output like…
1
vote
4 answers

Pivoting help needed

Please help me with this. I am totally stuck. I have coders block or something. I have the following table ID Name Cost Included ---- ---------- ------- ---------- 1 Package1 10.00 Yes 2 Package2 20.00 No 3 …
Captain0
  • 2,583
  • 2
  • 28
  • 44
0
votes
1 answer

Display cell value as column name using SQL

I have got table as given below in database: Name Grade Subject Ami HD Java Ami D C++ Bec D Java Bec P C++ Is it possible to display it in format given below…
0
votes
1 answer

sql server pivot data without aggregate function and print all values in column

Trying to figure how to write a pivot sql server statement. I have following table Source Table ID |Product |Event |Date ----------------------------------------------- 1 |Laptop |Search |2020-07-17 14:41:13.535 1 |Laptop |Product…
0
votes
1 answer

Pivot without aggregate

Please help me with this. I have the data as this: ID Name TotalCost ---- ---------------- ---------- 1 Wash, Dry & Fold 175.00 2 Hand Wash and Fold 275.00 3 Pressing Only 25.00 4 …
Glyieh
  • 41
  • 1
  • 11
0
votes
2 answers

SQL Server 2008 pivot without aggregate

I have table to test score data that I need to pivot and I am stuck on how to do it. I have the data as this: gradelistening speaking reading writing 0 0.0 0.0 0.0 0.0 1 399.4 423.8 0.0 0.0 2 461.6 508.4 424.2 431.5 3 501.0 525.9 492.8…
Bryan Lewis
  • 5,629
  • 4
  • 39
  • 45
0
votes
1 answer

Dynamically pivot table data without using aggregate function where columns are not consistent?

I have read many articles but am still not able to get the required result. I want to display all data for weight, pulsOx, bp and survey including redundant rows based on dates FromeDate and ToDate selected by user on front end. So columns will be…
mayurk
  • 121
  • 2
  • 11
-3
votes
1 answer

data Transformation using linq

pls i need to arrage my data in datatable input 1 to ouput table 1 Module | date(year) | xrate | yrate | cumrate ----------+------------+--------+---------+--------- No2_gft 2013 50 65 458 No2_gft 2014 …
1
2