[sqlalchemy] Help on Counting Please

2013-10-23 Thread Warwick Prince
Hi All Please excuse this relatively noob question, but I can not for the life of me find the answer in docs. (Probably because I don't know what I'm looking for). I have a table with two columns A and B. A can have many duplicate values. e.g. A B 1 a 1 b 1 c 1

Re: [sqlalchemy] Help on Counting Please

2013-10-23 Thread anh le
Hi, Have you tried: select A, count(*) from the_table group by A On Wed, Oct 23, 2013 at 4:17 PM, Warwick Prince warwi...@mushroomsys.com wrote: Hi All Please excuse this relatively noob question, but I can not for the life of me find the answer in docs. (Probably because I don't know what

Re: [sqlalchemy] Help on Counting Please

2013-10-23 Thread Warwick Prince
Hi Anh Thanks for clearing my head. I had devised considerably more complex attempts! So, the answer is; table.select().group_by(table.c.A).with_only_columns([table.c.A, func.count(1).label('count')]).execute().fetchall() :-) n 23/10/2013, at 7:29 PM, anh le anh...@gmail.com wrote: Hi,