here's how to do it in sql : SELECT *,count(id) as dupcnt FROM city c Group by c.name;
I don't know how to translate the select count(id) into sqlalchemy... On Tue, 2008-08-19 at 03:51 +0200, Wolverine wrote: > Hello. > I have a question regarding counting repetitive elements in the table. I > tried to do this on my own, but I'm hopeless. > If I have a field like for example "city" how can I count elements based > on this field? I mean. I have for example records in order like: > Paris, Munchen, Berlin, New York, Paris, Barcelona, Berlin, Paris, New > York, Los Angeles, etc. > How can I construct the query that will give me this: > Paris = 3, Munchen = 1, Berlin = 2, New York = 2, Barcelona = 1, Los > Angeles = 1? > I know this is somehow related to joins, but I'm not really sure how to > use them with Elixir. > Could anyone help me with this one? > I'd greatly appreciate it. > > Thanks in advance, > 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 -~----------~----~----~----~------~----~------~--~---
