 <p>Try this.....</p> <pre><code>SELECT username ,count(CASE WHEN tblCall.started_at BETWEEN '2014-11-10 00:00:00' AND '2014-11-10 23:00:00' THEN tblCall.call_id ELSE NULL END) AS [10-11-2014] ,count(CASE WHEN tblCall.started_at BETWEEN '2014-11-11 00:00:00' AND '2014-11-11 23:00:00' THEN tblCall.call_id ELSE NULL END) AS [11-11-2014] ,count(CASE WHEN tblCall.started_at BETWEEN '2014-11-12 00:00:00' AND '2014-11-12 23:00:00' THEN tblCall.call_id ELSE NULL END) AS [12-11-2014] FROM tblUser INNER JOIN tblCall ON tblCall.from_user_id = tblUser.[user_id] WHERE tblUser.can_manage_accounts = '1' AND tblUser.telephone_ext != '' AND tblUser.blocked = '0' GROUP BY tblUser.username </code></pre> <h2>Dynamic Sql</h2> <pre><code>CREATE TABLE TEST_TABLE(UserName VARCHAR(100), started_at DATETIME) GO INSERT INTO TEST_TABLE VALUES ('Mark' , '2014-11-13 23:59:59.997'),('Jane' , '2014-11-13 23:59:59.997'),('Sam' , '2014-11-13 23:59:59.997'), ('Mark' , '2014-11-13 23:59:59.997'),('Jane' , '2014-11-13 23:59:59.997'),('Sam' , '2014-11-13 23:59:59.997'), ('Holly' ,'2014-11-12 23:59:59.997'),('Sally' ,'2014-11-12 23:59:59.997'),('Mandy' ,'2014-11-12 23:59:59.997'), ('Holly' ,'2014-11-12 23:59:59.997'),('Sally' ,'2014-11-12 23:59:59.997'),('John' ,'2014-11-11 23:59:59.997'), ('James' ,'2014-11-11 23:59:59.997'),('John' ,'2014-11-11 23:59:59.997'),('James' ,'2014-11-11 23:59:59.997'), ('Josh' ,'2014-11-10 23:59:59.997'),('Jamie' ,'2014-11-10 23:59:59.997') GO </code></pre> <h2>Query</h2> <pre><code>DECLARE @Range_Start DATE = '2014-11-11' DECLARE @Range_End DATE = '2014-11-13' DECLARE @Date_Columns NVARCHAR(MAX); DECLARE @Sql NVARCHAR(MAX); SELECT @Date_Columns = STUFF(( SELECT DISTINCT ', ' + QUOTENAME(CONVERT(VARCHAR(10), started_at, 120)) FROM TEST_TABLE WHERE CAST(started_at AS DATE) &gt;= @Range_Start AND CAST(started_at AS DATE) &lt;= @Range_End FOR XML PATH(''),TYPE).value('.','NVARCHAR(MAX)'),1,2,'') SET @Sql = N' SELECT * FROM ( SELECT UserName, COUNT(*) AS Total, CONVERT(VARCHAR(10), started_at, 120) AS started_at FROM TEST_TABLE WHERE CAST(started_at AS DATE) &gt;= @Range_Start AND CAST(started_at AS DATE) &lt;= @Range_End GROUP BY UserName, CONVERT(VARCHAR(10), started_at, 120) ) t PIVOT ( SUM(Total) FOR started_at IN (' + @Date_Columns + ') )p ' Execute sp_executesql @Sql ,N'@Range_Start DATE, @Range_End DATE' ,@Range_Start ,@Range_End </code></pre> <h2>Result</h2> <pre><code>╔══════════╦════════════╦════════════╦════════════╗ ║ UserName ║ 2014-11-11 ║ 2014-11-12 ║ 2014-11-13 ║ ╠══════════╬════════════╬════════════╬════════════╣ ║ Holly ║ NULL ║ 2 ║ NULL ║ ║ James ║ 2 ║ NULL ║ NULL ║ ║ Jane ║ NULL ║ NULL ║ 2 ║ ║ John ║ 2 ║ NULL ║ NULL ║ ║ Mandy ║ NULL ║ 1 ║ NULL ║ ║ Mark ║ NULL ║ NULL ║ 2 ║ ║ Sally ║ NULL ║ 2 ║ NULL ║ ║ Sam ║ NULL ║ NULL ║ 2 ║ ╚══════════╩════════════╩════════════╩════════════╝ </code></pre>