oracle - SQL data convert column to row values -


i have table 1 column 100 rows of names. need display 3 names in row. 34 rows each row 3 names.

example:

name _____  raj sam guru tej avin sami fanst 

i need display above data as

name name1 name2 ____ _____ ______ raj  sam    guru tej  avin   sami fanst 

no condition need covert single column value 3 columns data.

oracle db

you can using conditional aggregation , rownum. this:

select max(case when mod(rn, 3) = 1 name end) name1,        max(case when mod(rn, 3) = 2 name end) name2,        max(case when mod(rn, 3) = 0 name end) name3        (select name, rownum rn       table t      ) t group trunc((rn - 1) / 3); 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -