Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Tsql query for Pivot table help

$
0
0

Hi 

I got a table like below


I want to group by T-Date and find the count of Transmitter if its "ABC" and next column must have the count of Receiver if its "ABC".


 

create  TABLE Transition (T_Date Datetime,  Transmitter VARCHAR(5), Receiver VARCHAR(5))
GO
-- Inserting Data into Table
INSERT INTO Transition(T_Date, Transmitter, Receiver)
VALUES('2013-01-29 00:00:00.000','ABC','XXX')
INSERT INTO Transition(T_Date, Transmitter, Receiver)
VALUES('2013-01-29 00:00:00.000','ABC','ZZZ')
INSERT INTO Transition(T_Date, Transmitter, Receiver)
VALUES('2013-01-29 00:00:00.000','ZZZ','ABC')
INSERT INTO Transition(T_Date, Transmitter, Receiver)
VALUES('2013-01-30 00:00:00.000','ABC','XXX')
INSERT INTO Transition(T_Date, Transmitter, Receiver)
VALUES('2013-02-01 00:00:00.000','ZZZ','ABC')
INSERT INTO Transition(T_Date, Transmitter, Receiver)
VALUES('2013-02-01 00:00:00.000','ZZZ','ABC')

GO

Thanks a lot in advance





Viewing all articles
Browse latest Browse all 23857

Trending Articles



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