1. C++ / Говнокод #5876

    +160

    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
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    MainDM->ADOQ_pr_kontr_vert->SQL->Add(
            "SELECT Smena, Prostenok, Popravka, Val_zad_temp, t.Zam1, t.Zam2, t.Zam3, t.Zam4, "
            "@sr1:=((t.Zam1 + t.Zam2 + t.Zam3 + t.Zam4) / 4) as sredn, "
            "@p:= @sr1 - (avgtempr.avgZam1 + avgtempr.avgZam2 + avgtempr.avgZam3 + avgtempr.avgZam4) / 4 as popravka  from "
            "(SELECT avg(Zam1) as avgZam1, avg(Zam2) as avgZam2, avg(Zam3) as avgZam3, avg(Zam4) as avgZam4 from "
            "(SELECT "
            "SUM(CASE "
            "WHEN kontroln_vertik.Zamer = 1 THEN kontroln_vertik.Value ELSE 0 "
            "END) as Zam1, "
            "SUM(CASE "
            "WHEN kontroln_vertik.Zamer = 2 THEN kontroln_vertik.Value ELSE 0 "
            "END) as Zam2, "
            "SUM(CASE "
            "WHEN kontroln_vertik.Zamer = 3 THEN kontroln_vertik.Value ELSE 0 "
            "END) as Zam3, "
            "SUM(CASE "
            "WHEN kontroln_vertik.Zamer = 4 THEN kontroln_vertik.Value ELSE 0 "
            "END) as Zam4 "
            "FROM kontroln_vertik WHERE kontroln_vertik.Date = \'2011-03-02\' "
            "and kontroln_vertik.Storona = 1  "
            "group by kontroln_vertik.Prostenok)  zameri) avgtempr, "
            "(SELECT kontroln_vertik.Smena,  kontroln_vertik.Prostenok, kontroln_vertik.Popravka, "
            "kontroln_vertik.Val_zad_temp, kontroln_vertik.Period_koks, "
            "SUM(CASE  "
            "WHEN kontroln_vertik.Zamer = 1 THEN kontroln_vertik.Value ELSE 0 "
            "END) as Zam1, "
            "SUM(CASE  "
            "WHEN kontroln_vertik.Zamer = 2 THEN kontroln_vertik.Value ELSE 0  "
            "END) as Zam2, "
            "SUM(CASE  "
            "WHEN kontroln_vertik.Zamer = 3 THEN kontroln_vertik.Value ELSE 0  "
            "END) as Zam3, "
            "SUM(CASE  "
            "WHEN kontroln_vertik.Zamer = 4 THEN kontroln_vertik.Value ELSE 0   "
            "END) as Zam4  "
            "FROM kontroln_vertik "
            "WHERE kontroln_vertik.Date = \'2011-03-02\' and   "
            "kontroln_vertik.Storona = 1  "
            "group by kontroln_vertik.Prostenok) t"
            );

    Запостил: qbasic, 03 Марта 2011

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

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