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

Menyisir hasil dari penyatuan semua menjadi satu baris ketika beberapa kolom memiliki nilai yang berbeda

Hapus tracking_id dari subkueri dan gunakan union :

(select trv.requested_date, trv.requested_status
from  tbl_trackvalue as trv, tbl_tracking as t , tbl_offers as off , tblusers as usr
where t.id=trv.tracking_id  and off.id=t.offer_id and  usr.id=trv.tr_user_id and usr.id='1454' 
and trv.payment_status='pending' and trv.requested_status='declined'  group by trv.tr_user_id, trv.requested_date order by trv.requested_date asc )
union
(select mlc.requested_date, mlc.requested_status
from  tbl_trackvalue as trv ,tbl_tracking as t , tbl_offers as off , tblusers as usr, tbl_mailchimp_trackvalue as mlc
where trv.tracking_id=mlc.tracking_id  and off.id=t.offer_id and  usr.id=trv.tr_user_id and usr.id='1454' 
and mlc.payment_status='pending' and mlc.requested_status='declined'  group by trv.tr_user_id, mlc.requested_date order by mlc.requested_date asc ) 


  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. MySQL max_allowed_packet param apa masalahnya?

  2. Bagaimana cara memperbaiki mysqli::real_connect():kesalahan operasi SSL gagal?

  3. Peningkatan otomatis id tabel menggunakan kombinasi string dalam database secara otomatis

  4. Kesalahan sintaks pembatas MySQL

  5. Cara MEMESAN BERDASARKAN KASUS di Doctrine2 (Symfony2)