Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

Different Count

$
0
0

Hi, 

I have a view as below

id          month            year           service
----------------------------------------------------
4855        4                2010           SERVICE1
4855        4                2010           SERVICE1
4855        4                2010           SERVICE2
4866        5                2011           SERVICE1
4866        5                2011           SERVICE2
4866        5                2011           SERVICE2
4866        6                2011           SERVICE2
4866        5                2012           SERVICE2

How can i add two columns : CountService1 and CountService2 in order to have

id          month            year           service                 CountService1             CountService2
------------------------------------------------------------------------------------------------------------
4855        4                2010           SERVICE1                 2                               1
4866        5                2011           SERVICE1                 1                               2
4866        6                2011           SERVICE2                 0                               1
4866        5                2012           SERVICE2                 0                               1

The idea is to count distinct service fro same (id,month,year)

Thanks


Viewing all articles
Browse latest Browse all 1418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>