Group by SQL with count
Posted
by snorlaks
on Stack Overflow
See other posts from Stack Overflow
or by snorlaks
Published on 2010-06-14T08:40:04Z
Indexed on
2010/06/14
8:42 UTC
Read the original article
Hit count: 637
sql
Lets say we have got rows like that:
MyTable ID Name Product 1 Adam x 2 Adam y 3 Adam z 4 Peter a 5 Peter b
Using query like:
Select Name, Count(Product) from MyTable
group by Name
results will be:
Adam 3 Peter 2
But I would like results like:
1 Adam x 3 2 Adam y 3 3 Adam z 3 4 Peter a 2 5 Peter b 2
I hope Ypu know what I mean Could You help me with that query, thanks for help, Bye
© Stack Overflow or respective owner