Re: Self Join using QuerySet

2009-03-05 Thread Alex Gaynor
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

Re: Self Join using QuerySet

2009-03-05 Thread AJ
<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 > >

Self Join using QuerySet

2009-03-05 Thread Adam Nelson
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