Alex Marandon pisze: > I think your problem is a bit similar to the one posted earlier on > this list by Chris. Basically what you need to do is make a join > between your three tables and aggregate your visit dates with a max() > while grouping on the your users. You'll also need where clauses to > limit the result set to the requested place. > > In SQL that would roughly be something like: > > SELECT users.name, places.name, max(visit.date) FROM users, places, visits > WHERE > users.id = visits.user_id AND visits.place_id = places.id AND > place.name = 'London' > GROUP BY users.id; > > If you post your Elixir models I can try to get the SQLAlchemy query > which does that. > Thanks a lot for your answer Alex. I'm sorry I didn't post reply any sooner, I was too busy. Since I didn't have time to really find a better solution, I managed to get around the problem in pure Python. I know it's a bit slower than SQL, but for the time being it's not a priority. When I'll find some time I'll try to get back to this problem and rewrite it in pure Python.
Greetings, Karol Tomala --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SQLElixir" 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/sqlelixir?hl=en -~----------~----~----~----~------~----~------~--~---
