Rows in their own columns depending on their date and simbolized by 'x'
- by Chandradyani
Dear All, please help me since I'm newbie in SQL Server. I have a select query that currently produces the following results:
DoctorName Team Visit date
dr. As A 5
dr. Sc A 4
dr. Gh B 6
dr. Nd C 31
dr As A 7
Using the following query:
SELECT d.DoctorName, t.TeamName, ca.VisitDate FROM cActivity AS ca
INNER JOIN doctor AS d ON ca.DoctorId = d.Id
INNER JOIN team AS t ON ca.TeamId = t.Id
WHERE ca.VisitDate BETWEEN '1/1/2010' AND '1/31/2010'
I want to produce the following:
DoctorName Team 1 2 3 4 5 6 7 ... 31 Visited
dr. As A x x ... 2 times
dr. Sc A x ... 1 times
dr. Gh B x ... 1 times
dr. Nd C ... X 1 times