How does Oracle turn rows into columns?

the data found is like this. Is there any way to change the data into the following format? You still have to deal with

in the backend code.
Aug.17,2021

oracle row transfer column


if the value range of name is fixed, you can use the following statement:
select city, sum (cnt_1), sum (cnt_2), sum (cnt_3)
from (

)
select
  city, 
  decode(name, '', total, 0) as cnt_1,
  decode(name, '', total, 0) as cnt_2,
  decode(name, '', total, 0) as cnt_3
from t

)
group by city

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36bd6-2b7b5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36bd6-2b7b5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?