sql >> Databáze >  >> RDS >> Mysql

jak najít potřebné hodnoty jedinečné proměnné ze dvou tabulek

Mohlo by to být něco takového

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. Mohu spouštět příkazy MySQL SQL ve FireFoxu?

  2. Chyba během instalace – Inicializace databáze se nezdařila

  3. Vložená IP do databáze MySQL se pokaždé změní

  4. MySQL JOIN / GROUP_CONCAT druhý stůl?