I have a sql that return these columns.

Material---Description---Price---Type
-------------------------------------
Test1--------Desc1--------21----Ak1--
Test1--------Desc1--------29----Ak2--
Test1--------Desc1--------31----Ak3--
Test1--------Desc1--------41----Ak4--
Test2--------Desc2--------12----Ak1--
Test2--------Desc2--------22----Ak2--
Test2--------Desc2--------31----Ak3--
Test2--------Desc2--------51----Ak4--

My question is, if it can take values from a colum and make these values to new columns and take a value from a second column to these new columns. Values for the new columns are price column. Like this:

Material---Description---Ak1---Ak2---Ak3---Ak4
----------------------------------------------
Test1--------Desc1-------21----29----31----41-
Test2--------Desc2-------12----22----31----51-

asked 27 Nov '14, 13:54

Rolle's gravatar image

Rolle
379213142
accept rate: 0%

edited 27 Nov '14, 15:51

As you have yourself used the "pivot" tag, just have a look at the other FAQs with that same tag...

(27 Nov '14, 17:55) Volker Barth

Have a look at SQL Anywhere 17's PIVOT feature.

Alternatively, try this: Crosstab, Rotate, Pivot

permanent link

answered 27 Nov '14, 15:27

Breck%20Carter's gravatar image

Breck Carter
25.7k427586845
accept rate: 20%

edited 09 Mar '16, 08:33

Volker%20Barth's gravatar image

Volker Barth
30.3k300452660

1

Version 17?

Man, I seem to have missed something by not having taken part in the current summit:)

(27 Nov '14, 17:52) Volker Barth
Replies hidden

Agree :), me too. I have heard about v17. But not much.

(28 Nov '14, 04:59) Vlad
1

Yes, there is much that is cool coming in 17... there may even be room for a "Top 17 Cool New Features" article :)

(28 Nov '14, 07:38) Breck Carter

when will version 17 be released, is there somewhere you can read about the new features?

(28 Nov '14, 12:42) M G
Replies hidden
1

SQL Anywhere 17 may be feature-complete at the end of 2014 and released in the third quarter of 2015.

No mention has been made of a beta, and if recent history (Raspberry Pi)

is any indication, alt text "SAP don't have to show you any stinking beta!"

(28 Nov '14, 14:07) Breck Carter
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:

×9

question asked: 27 Nov '14, 13:54

question was seen: 823 times

last updated: 09 Mar '16, 08:33