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
178
votes
10 answers

TSQL Pivot without aggregate function

I have a table like…
ctrlShiftBryan
  • 27,092
  • 26
  • 73
  • 78
40
votes
5 answers

SQL Transpose Rows as Columns

I have an interesting conundrum which I believe can be solved in purely SQL. I have tables similar to the following: responses: user_id | question_id | body ---------------------------- 1 | 1 | Yes 2 | 1 | Yes 1 …
Topher Fangio
  • 20,372
  • 15
  • 61
  • 94
6
votes
3 answers

Sql Server 2008 - PIVOT without Aggregation Function

I know you've got multiple topics touching on this. But, I havent found one that addressed my needs. I need to (on demand) pivot select deep table data to a wide output table. The gotcha in this is that I cannot use an aggregate with Pivot because…
6
votes
1 answer

Pivot tables without aggregation?

I have a list of items - each item has a title, plus a bunch of attributes, including a date. If I drop the date into the row box of a pivot table, then group it, and drop the title below - so I have Years, Quarters, Created On, Title, I get a nice…
user146562
4
votes
2 answers

Should I use Pivot to translate SQL Server 2008 row values to column names when I don't want to use an aggregate?

I am trying to get a handle on manipulating table data into more visually appealing formats for output. This could be part of the problem as what I want may be intended for separate reporting software. I have a table that looks like this teacher …
markA
  • 1,609
  • 2
  • 17
  • 26
3
votes
2 answers

In MySQL, How do you dynamically SELECT the values of one table, as columns in another?

I'm no MySQL guru, but I get around the basic stuff pretty well. Thanks for your feedback. I have two tables user and favorite. Each user can have multiple unique favorites. table user u [ user_id + name ] 100 | Sally table favorite fav […
qodeninja
  • 10,946
  • 30
  • 98
  • 152
3
votes
3 answers

sql pivot with no aggregate

Whilst trying to pivot a sql table I came across this post Here . By using this method I have created a query. However i have now realised that it of course aggregates the results with the MAX function. However I need the Colum to pivot but for…
Tom
  • 33
  • 1
  • 4
3
votes
2 answers

how do you pivot sql data without aggregating a column

I have the following output in a query. SKILL LEVEL SCORERANGE ----------------------------------------------------------------------------- Stunts LOW…
Seth Spearman
  • 6,710
  • 16
  • 60
  • 105
3
votes
2 answers

How to create a pivot query

Imagine I have this table: Column A | Column B | Column C ------------------------------ 111 X 10 111 Y 12 How can I query this table to show the results like these: Column A | X | …
Eduardo Brites
  • 4,597
  • 5
  • 36
  • 51
3
votes
2 answers

convert xml string in a sql table to dynamic columns

I have two tables (using table variables for illustration. You can run these directly in management studio) that are related by the Id column. Items in the first table has some standard set of columns and the second table has some extended…
coder net
  • 3,447
  • 5
  • 31
  • 40
2
votes
3 answers

simple sql: how do I group into separate columns?

Say I keep stocks prices in a 3 column table like this: create table stocks( ticker text, day int, price int ); insert into stocks values ('aapl', 1, 100); insert into stocks values ('aapl', 2, 104); insert into stocks values ('aapl',…
user1481
  • 849
  • 1
  • 5
  • 15
2
votes
1 answer

Pivot data in linq

I've a data set which returns me this set of results: Date |Location |Amount 11.03.2011|Location1| 1000 11.03.2011|Location2| 1000 11.03.2011|Location3| 1000 12.03.2011|Location1| 1000 12.03.2011|Location2| 1000 …
matan
  • 31
  • 1
  • 9
2
votes
2 answers

How to PIVOT table with variable data in columns

All, rownum respnum q2 q3 ----------------------------------- 1 33 Missy 155-4 2 46 Melissa 55-98 3 73 Emma 998-4 How would you PIVOT the above table to show the desired results below?…
J.Pyz
  • 213
  • 1
  • 6
  • 13
2
votes
1 answer

How to do a Pivot in Linq

Possible Duplicate: How can i made a pivot for this I have a table as provided below ID | value | Name --------+---------------+------------------ 1 Digital Model 1 companyA Manufacturer 2 …
B_pati
  • 69
  • 2
  • 10
2
votes
4 answers

sql query to show results vertically

How to transform this: ID Name Description 1 Test1a TestDesc1a 1 Test1b TestDesc1b 2 Test2a TestDesc2a 2 Test2b TestDesc2b into this: ID Column 1 2 1 Name test1a test1b 1 …
user194076
  • 8,787
  • 23
  • 94
  • 154
1
2