Quantcast
Channel: SCN : Discussion List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 5653

Transpose Rows in Columns

$
0
0

Hey.

 

I need to transpose a Table.

 

That's how it looks like:

 

TABLE:

 

OBJEK     ATINN     ATWRT

1                   a               5

1                    b               8

1                    c               6

2                    b               4

2                    c                9

 

I want to have following structure:

 

TABLE2:

 

OBJEK     ATWRTa     ATWRTb     ATWRTc

1                    5               8               6

2                    ?               4               9

 

I thougt of following query:

 

select "OBJEK",

  (case when "ATINN" = 'a' then "ATWRT"  end) as "ATWRTa",

(case when "ATINN" = 'b' then "ATWRT" end) as "ATWRTb",

  (case when "ATINN" = 'c' then "ATWRT"  end) as "ATWRTc"

from

  "P1591085134"."AUSP1"

group by "OBJEK"

 

But the compiler tells me that "ATINN" is not a group by expression...

Without the group by command i get the following result:

 

OBJEK     ATWRTa     ATWRTb     ATWRTc

1                    5               ?               ?

1                    ?               8               ?

1                    ?               ?               6

2                    ?               4               ?

2                    ?               ?               9

 

Is there another possibility? Probably with a stored procedure?


Viewing all articles
Browse latest Browse all 5653

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>