How to convert selected table style

Hi Guys,

Looking at pic1(a table), how would i write SQL statement to result the pic2(another table) no matter column name. and the second of time is not stable, how to state the where clause and change the style of table(selected results row to column)

Thanks in advanced