Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

transpos kolom ke baris

Anda dapat menggunakan UNION ALL untuk ini

select 'one' as label,  curdate() as val
UNION ALL
select 'two' as label,  date_sub(curdate(), interval 15 day) as val
UNION ALL
select 'three' as label,  date_sub(curdate(), interval 30 day)  as val
UNION ALL
select 'four' as label,  date_sub(curdate(), interval 45 day) as val
UNION ALL
select 'five' as label,  date_sub(curdate(), interval 60 day) as val
UNION ALL
select 'six' as label,  date_sub(curdate(), interval 75 day)  as val
UNION ALL
select 'seven' as label,  date_sub(curdate(), interval 90 day) as val



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Menyimpan Perubahan di SlickGrid dengan php

  2. mysql memesan dengan menghitung kinerja

  3. Log QUERIES tidak menggunakan INDEX - MySQL

  4. Dialek SQL Tidak Dikonfigurasi (Phpstorm)

  5. Cara mengimpor file sql BESAR ke tabel mysql