Re: Max function and grouping with Oracle

2019-02-26 Thread Dan Davis
> That is not the case on MySQL and PostgreSQL for. example. +1 Insightful. I'm still trying to get my Ops guys to let us drop and re-create databases for Postgres/MySQL. They are very afraid to give that permission because they worry about production databases, and it is hard for them to mana

Re: Max function and grouping with Oracle

2018-11-27 Thread Simon Charette
Dan, The root of the issue here is that you query is asking to retrieve all fields from the Parent table and perform an aggregation on the JOIN'ed child table. That results in the following query SELECT parent.*, MAX(child.updated_timestamp) FROM parent JOIN child ON (child.parent_id = parent.i

Re: Max function and grouping with Oracle

2018-11-26 Thread Dan Davis
Looks like there is no problem here. Django groups by whatever is in the query, so that this would be done as follows: Parent.objects.values('id').annotate(child_updated_timestamp=models.Max('child_updated_timestamp')) On Monday, November 26, 2018 at 12:32:09 PM UTC-5, Dan Davis wrote: > > I