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

bagaimana menemukan nilai yang diperlukan dari variabel unik dari dua tabel

Bisa jadi seperti ini

SELECT hops.hop_route,count(plan_info_upload.*) as no_of_2G, SUM(plan_info_upload.2G_bw) as total_2G_bw FROM(
SELECT DISTINCT (hops.hop_route) as hop_route FROM (
                SELECT DISTINCT hop_1 as hop_route FROM hop_without_router
                 UNION 
                SELECT DISTINCT hop_2 as hop_route FROM hop_without_router
                 UNION 
                SELECT DISTINCT hop_3 as hop_route FROM hop_without_router
                 UNION 
                SELECT DISTINCT hop_4 as hop_route FROM hop_without_router
                 UNION 
                ......
                SELECT DISTINCT hop_9 as hop_route FROM hop_without_router) as hops ) as unique_hops )  LEFT JOIN plan_info_upload ON hops.hop_route = plan_info_upload.route_path



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Cara menjalankan kueri SQL RAW di PhalconPHP

  2. Kondisi tanggal menggunakan logika Pencarian

  3. Mengambil teks UTF-8 dari MySQL di R kembali ????

  4. Tidak Dapat Menjatuhkan kunci asing di MySQL

  5. 1064, Anda memiliki kesalahan dalam sintaks SQL Anda;... Python MySQL