×Welcome aboard! We are happy you are here and wish you good net-raft!



Together We Can Simplify The World

the current number of solutions:  2360
.htaccess (1x)    AJAX (13x)    ANGULARJS (161x)    ASP (1x)    ASP.NET (6x)    BACKBONE.JS (47x)    BOOTSTRAP (12x)    C# (224x)    COFFEESCRIPT (28x)    CSS (71x)    HTML (47x)    JADE (34x)    JAVA (51x)    JAVASCRIPT (430x)    JQUERY (390x)    JQUERY MOBILE (5x)    JSON (5x)    LARAVEL (25x)    MYSQL (9x)    NODEJS (162x)    ORACLE SQL (19x)    PERL (2x)    PHP (295x)    PYTHON (10x)    REACT (62x)    RUBY (25x)    RUBY ON RAILS (1x)    SHELL (2x)    SQL (90x)    SQL SERVER (3x)    TYPESCRIPT (51x)    VB.NET (32x)    W3.CSS (6x)    W3.JS (40x)    
join us

click to create your account

rows to columns sql

(sql rows columns )

- SQL

 viewed 43

Comment:
SQL

0

MY_TEST_TABLE:

NAME MONTH INV
name1 201609 30
name2 201610 50
name3 201611 60

------------------------------------------------------------------

select * from MY_TEST_TABLE
pivot (
max(INV)
for MONTH in ( '201609' "201609",
'201610' "201610",
'201611' "201611"
)
)
order by NAME

     

created: 3 months ago

The power of the user (%)

45%

Do you know a little more effective code ? Feel free to optimize ...


haven't you found what you're looking for ?
Write us your question ...
Login is not needed.


The most helpful SQL solutions
Likes Solution Technology
25 convert string to date sqlSQL
19 How to get the last record from table using sql ?SQL
17 rows to columns sqlSQL
14 How to convert the values to lowercase using sql ?SQL
12 create table sqlSQL
11 How to get the last 10 records using mysql ?SQL
4 how to execute insert into select using sql ?SQL
4 insert new column into table sqlSQL
3 how to execute select into using sql ?SQL
3 How to specify multiple values in a WHERE clause using sql ?SQL
Check out all of SQL ...
The most viewed SQL solutions by country
Solution Country
How to specify multiple values in a WHERE clause using sql ?Cinque Terre
How to get the last 10 records using mysql ?Cinque Terre
convert string to date sqlCinque Terre