2009/2/10 Alessandro <alessandro.ron...@gmail.com>

>
>
> 2009/2/10 Russell Keith-Magee <freakboy3...@gmail.com>
>
>>
>>
>> i.e., plural modules, not singular module, in the Max lookup. It's the
>> reverse lookup name for the module relationship on Module_scheme. For
>> future reference, the message on the FieldError tells you the right
>> name - modules.
>>
>
Is it possible to do a group by of a time selection, like GROUP BY
DAY(time_field) ?

I need to make a query like this:

SELECT SUM(peak), giorno FROM (SELECT MAX(power_peakdaily) AS peak
,DAY(time) AS giorno FROM fotovoltaico_modules, fotovoltaico_module_scheme
WHERE fotovoltaico_module_scheme.plant_id=%s AND year(time)= %s AND
month(time)=%s AND scheme_id=fotovoltaico_module_scheme.id GROUP BY
fotovoltaico_module_scheme.id, DAY(time) ORDER BY DAY(time)) AS tabella
GROUP BY giorno ;"%( year, month, self.id))




-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to