pics/db/queries/#filters-can-reference-fields-on-the-model
>
> On Mar 5, 1:46 pm, Adam Nelson <a...@varud.com> wrote:
> > Is it possible to do a self join using QuerySet?
> >
> > I'm looking to simulate a query like this:
> >
> > SELECT b.created_on, SUM(a.v
<a...@varud.com> wrote:
> Is it possible to do a self join using QuerySet?
>
> I'm looking to simulate a query like this:
>
> SELECT b.created_on, SUM(a.vote)
> FROM votes a JOIN votes b ON a.created_on <= b.created_on
> WHERE a.object_id = 1
> GROUP BY 1
>
>
Is it possible to do a self join using QuerySet?
I'm looking to simulate a query like this:
SELECT b.created_on, SUM(a.vote)
FROM votes a JOIN votes b ON a.created_on <= b.created_on
WHERE a.object_id = 1
GROUP BY 1
Which finds the sums for votes before the datetime of each v
3 matches
Mail list logo