sql - How to convert Row values into column which is containing string values? -


this table name table1

id |    columnname        |  columnvalue -----------------------------------  48 |    vehicleno         |  abc-0134 48 |    in-time           |  10:00 48 |    out-time          |  11:00 

and want result bellow:

id  | vehicleno  | in-time |  out-time 

48  | abc-0134   | 10:00   |  11:00 

please me desired result.

one method using pivot .

select [id], [vehicleno],        [in-time],        [out-time]   (select id,                columnname,                columnvalue           tablename)        pivot (max(columnvalue)              coulnname in([vehicleno],                               [in-time],                               [out-time])) piv  

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -