The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Hello All,

I have a table like pressure result that contains the multiple records based on a single parent record. The table structure like-----

s.no               parent id                                     result
1                       10                                           9.5 
2                       10                                           8.2
3                       10                                           7.2
...                     ...                                          ....  
...                    .....                                         ....
20                      10                                           8.9

So now i need result like this:----

column header------1a   1b   2a   2b  3a  3b  4a  4b  5a  5c ............19a   19b    20a   20b
column value-----  9.1  6.2  7.8......................................................9.8   8.7

asked 20 Dec '13, 08:17

Gopal's gravatar image

Gopal
16112
accept rate: 0%

edited 20 Dec '13, 09:30

Mark%20Culp's gravatar image

Mark Culp
22.3k9129262


Take a look at the other questions (and answers) that have been asked about pivot/unpivot - I believe that these answers will tell you how to do it. i.e. you need to construct a SQL statement based on your requirements and then EXECUTE IMMEDIATE the statement to get the result set.

HTH

permanent link

answered 20 Dec '13, 09:29

Mark%20Culp's gravatar image

Mark Culp
22.3k9129262
accept rate: 40%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×8

question asked: 20 Dec '13, 08:17

question was seen: 919 times

last updated: 20 Dec '13, 09:30