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 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      d
> 2      f
> 2      g
> 3      z
>
> I want to have a result that returns all the values of A, and how many times 
> they appear in the table.
>
> Sample result from above would be;
>
> 1    4
> 2    2
> 3    1
>
> Clearly, I'm no SQL wizz, so I have the added issue of not knowing the raw 
> SQL, let alone SQLAlchemy's take on it.
>
> If you can provide the answer using table.select() type query, rather than 
> the ORM equivalent it would be most appreciated.  :-)
>
> Thanks in anticipation.
>
> Cheers
> Warwick
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to