conditions on count in a select

Posted by Luca Romagnoli on Stack Overflow See other posts from Stack Overflow or by Luca Romagnoli
Published on 2010-03-26T13:32:03Z Indexed on 2010/03/26 13:43 UTC
Read the original article Hit count: 137

Filed under:
|

Hi, i have a table like this:

Table(MissioneID, Type)

Type can be 1,2 or 3

i have to count missions by type value:

ex. if table's content is:

MissioneID Type
1,1
1,2
1,1
2,3
1,2

The result of query is

MissioneID,Count1,Count2,Count3
1, 2,2,0
2,0,0,1

How can i do?

thanks

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about count