sql >> Database teknologi >  >> RDS >> Mysql

hvordan man finder nødvendige værdier af en unik variabel fra to tabeller

Kunne være sådan noget her

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. Sådan finder og erstatter du tekst i MySQL-database ved hjælp af SQL

  2. Sådan installeres og sikres MariaDB på CentOS 7

  3. Indhentning af den primære nøgle fra et indsat datasæt til at kæde ind i andre indsættelser

  4. Hvordan opretter man forbindelse til lokal vært ved hjælp af JDBC?