0

Is there a way to show row values as column values. Lets say I have a table called A and which contains 5 records with 3 columns. Below image show the data set. Rows always 5.

enter image description here

In Here I need to show value column values in a line with temporary column names If I use simple select query as Select row1.value as col1, row2.value as col2, row3.value as col3, row4.value as col4, row5.value as col5

so my expected result need to show as below

enter image description here

Please tell me how to use select query to get this result in MySQL

DevAra
  • 531
  • 3
  • 10
  • 35
  • A SQL query has fixed columns, but a table has a variable number of rows. So, no, generally you cannot do this in SQL. Unless you know you always want to select IDs 53 to 58 only. Such display issues should not be dealt with in SQL anyway, but in your app or Website that is retrieving the data from the database. – Thorsten Kettner Nov 26 '21 at 07:43
  • Thanks for the reply. I updated question. In here rows count always 5 – DevAra Nov 26 '21 at 07:48
  • https://stackoverflow.com/questions/1241178/mysql-rows-to-columns – ProDec Nov 26 '21 at 07:49

0 Answers0