On Mon, Mar 16, 2009 at 11:07 AM, koranthala <[email protected]> wrote:
>
> Hi,
> I downloaded Django 1.1 due to aggregation support.
> But I am facing one issue which I cannot seem to overcome.
> I have two fields which represents two different times.
> I want to get the sum of difference of times - and I am unable to
> do so.
> Basically, I want to do as follows:
> SELECT SUM (time2 - time1) FROM _TABLE_ WHERE __XXX___
>
> I tried 2 options:
> 1. self.filter( XXX).aggregate(diff=Sum('time2 - time1'))
> 2. self.filter (XXX).aggregate(t2=Sum('time2'), t1= Sum('time1')) - so
> that I can do t2 - t1 later.
>
> Both is not supported in Django. I have raw SQL code in model
> Manager for the same. I thought using Django Aggregation is better. Is
> such operations going to be supported in Django 1.1 ?
>
> Regards
> Koran
>
>
>
> >
>
Right now that isn't possible, is there any reason you couldn't just bring
the seperate SUMs into python and do the subtraction there, I realize it
isn't quite as clean but the overhead should be minimal?
Alex
--
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---