On Fri, Dec 19, 2008 at 12:12 AM, Sean DiZazzo <[email protected]> wrote: > > Hi group, > > I'm a MySQL and Turbogears novice. Looking for some help in setting > up a database query. 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 | filename | date | > -------------------------------------- > 1 foo.txt 12_07_2008 > 2 poo.txt 12_01_2008 > 3 foo.text 12_06_2008 > > I'd like to query the db so the resulting SearchResults object only > contains records 1 & 2. > sorry but your text doesn't match the example how are records 1 and 2 duplicated? Do you have the raw SQL of what you want to accomplish?
On a related note, unless you have a bug code base already build on SO, I strongly suggest you start your migration towards SQLAlchemy, for many reasons you can search the group for including that overthere this is death simple. > I found some complex sql queries using inner joins, but couldn't > figure out how to use them with sqlobject. I also tried to filter the > results of a full query, but came to dead ends. > > files = model.Files.select(???) > > Any help would be appreciated! > > ~Sean > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

