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
Post a Comment