question

spriya avatar image
spriya asked

SQL query to sort the data

I am new to SQL, can you please help me in retrieving the values as per below screen shot and below is my backend query results.(backend-data.png), i want to display the data in sql-output.png format. I am trying to sort the DEG column (all the 0's , 8, 160) and get the corresponding values. For an instance, if DEG is 0, I should get the corresponding values(for height 5) ' i.e. (0.91,-0.29, -1.78,-2.05 etc). Similarly i have to group and display the values as per the screenshot L02Kj.png. [1]: /storage/temp/4188-sql-output.png
sql server 2008 r2
backend-data.png (27.3 KiB)
sql-output.png (31.5 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
gm_ignat avatar image
gm_ignat answered
First, I try to create a temporary table which contains the values from COL_1 for DEG = 0. I move the values with pivot, in rows in pivot_table. Again, a temporary table which contains the values from COL_2 for DEG = 0. I move the values with pivot in rows, insert in above table (pivot_table).
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Waqar_lionheart avatar image Waqar_lionheart commented ·
PIVOT IS WAY TO GO
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.