Changes between Version 22 and Version 23 of AdvancedReports


Ignore:
Timestamp:
01/10/23 21:48:34 (17 months ago)
Author:
201235
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedReports

    v22 v23  
    115115
    116116== Прашалник 3
    117 (text here)
    118 {{{#!sql
    119 --sql here
     117За секоја храна, бројот на миленици кои ја јадат таа храна кои имаат ниска физичка активност и примаат терапии.
     118{{{#!sql
     119select
     120        food.name_food as food_name,
     121        sum(q2.has_therapies) as total_pets
     122from
     123        (
     124        select
     125        q1.pet_id,
     126        q1.has_therapies
     127        from
     128                (
     129                        select
     130                                pet.id_pet as pet_id,
     131                                count(therapy.id_therapy) as has_therapies
     132                        from
     133                                pet
     134                        join
     135                                pet_needs_therapy pnt
     136                                on pnt.id_pet = pet.id_pet
     137                        join
     138                                therapy
     139                                on therapy.id_therapy = pnt.id_therapy
     140                        group by
     141                                pet.id_pet
     142                ) as q1
     143                join personal_profile 
     144                        on q1.pet_id = personal_profile.id_pet
     145                where
     146                        personal_profile.physical_activity = 0
     147        ) as q2
     148join pet_preferably_eats_food ppef
     149        on ppef.id_pet = q2.pet_id
     150join food
     151        on food.id_food = ppef.id_food
     152group by
     153        food.id_food
     154order by
     155        total_pets
    120156}}}
    121157