0

I have a query that returns the following resultset:

GROUP_ID | ORDER | ID
1        | 1     | 1000
1        | 2     | 1004
1        | 3     | 1005
2        | 1     | 2400
2        | 2     | 2402
3        | 1     | 3000
3        | 2     | 3001
3        | 3     | 3002

And I need to turn rows into columns (ORDER values will become columns) like this:

GROUP_ID | 1     | 2     | 3 
1        | 1000  | 1004  | 1005
2        | 2400  | 2402  | 
3        | 3000  | 3001  | 3002

How can I do this?

Taryn
  • 242,637
  • 56
  • 362
  • 405
juliano.net
  • 7,982
  • 13
  • 70
  • 164
  • What version of Oracle? Also you've mentioned the correct term "pivot", have you tried to write one? Please edit your post to include your attempts at writing this. Another duplicate would be -- http://stackoverflow.com/questions/4841718/oracle-sql-pivot-query – Taryn Jun 04 '14 at 17:49
  • Please ignore this question, the only thing that I needed to do was adding the group_id column in my SELECT clause. – juliano.net Jun 04 '14 at 18:04

0 Answers0