[SQLObject] Complex Inner Join/Subselect Query

2008-12-21 Thread Sean DiZazzo
I originally posted this on the turbogears list, but they suggested I post it here. I'm trying to query a table by a specific field (not unique), but only have the database return the most recent record of any duplicate record. For example: Files -- id | f

Re: [SQLObject] Complex Inner Join/Subselect Query

2008-12-21 Thread Oleg Broytmann
On Sun, Dec 21, 2008 at 01:03:34PM -0800, Sean DiZazzo wrote: > I found this query that gives me the correct results: > > """SELECT files.* FROM files INNER JOIN (SELECT MAX(id) AS id FROM files > GROUP BY filename) ids ON files.id = ids.id""" > > The problem is that i can only run it with the _c