sql - How to convert rows to columns? -


i have table this:

name     value --------------- toyota   yellow nissan   blue toyota   red nissan   black 

i want convert table this:

toyota    nissan ---------------- yellow    blue red       black 

how can this?

i tried using command:

select * (case name when 'toyota' value end) toyota,          (case name when 'nissan' value end) nissan testtable 

but results in table this:

toyota     nissan ---------------------- yellow     null null       blue red        null null       black 

help? thanks

let me ask question , illustrate why isn't doing expected.

you want

toyota    nissan ---------------- yellow    blue red       black 

but equally have

toyota    nissan ---------------- yellow    black red       blue 

how database decide yellow , blue go in same line? there nothing in original table tie 2 rows together.

the database doesn't know of black or blue associate yellow with, doesn't associate either.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

javascript - addthis share facebook and google+ url -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -