1. SQL / Говнокод #25628

    −2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    SELECT country, QTY, MIN(launched)
    FROM (SELECT country, launched, COUNT(name) QTY
     FROM Classes c JOIN 
     Ships s ON c.class = s.class
     GROUP BY country,launched
     HAVING COUNT(name) = (SELECT MAX(qty) 
     FROM (SELECT country,launched,COUNT(name) qty
     FROM Classes c1 JOIN 
     Ships s1 ON c1.class = s1.class
     WHERE country = c.country
     GROUP BY country,launched
     )e
     )
     )T
    GROUP BY t.qty, t.country;

    -2 sql ex rating
    я так понял необходимо ещё как-то добавить проверку на NULL?

    Запостил: 5252mmr, 20 Мая 2019

    Комментарии (6) RSS

    Добавить комментарий