Hi, I am trying to use SQL to take all the data from my Table and summarise it on Week ID and Tier one can someone help please.
This is whati am currently using but it gives all data and i want it to summarise all under Week ID and Tier 1 only how many occur underTier 1 by week.
Declare @StartDate DATETIME
Declare @EndDate DATETIME
SET @StartDate = CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, GETDATE()-35)))
SET @EndDate = CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, GETDATE()+1 )))
SELECT
[Number]
,[CTier1]
,[CTier2]
,[Driver1]
,[Driver2]
,[PriTier]
,[Tier1]
,[Tier2]
,[Tier3]
,[Tier4]
,[CLDirection]
,[CLOutcome]
,[Comments]
,[Outcome]
,[RCause]
,[SubDate]
,[SubTime]
,[UID]
,[UName]
,[WeekNo]
,[WeekID]
,[LogDuration]
,[ContactNum]
FROM [CSCallLogger].[dbo].[tbl_Logs]
where [SubmittedDate] between @startdate and @enddate
This is whati am currently using but it gives all data and i want it to summarise all under Week ID and Tier 1 only how many occur underTier 1 by week.
Declare @StartDate DATETIME
Declare @EndDate DATETIME
SET @StartDate = CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, GETDATE()-35)))
SET @EndDate = CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, GETDATE()+1 )))
SELECT
[Number]
,[CTier1]
,[CTier2]
,[Driver1]
,[Driver2]
,[PriTier]
,[Tier1]
,[Tier2]
,[Tier3]
,[Tier4]
,[CLDirection]
,[CLOutcome]
,[Comments]
,[Outcome]
,[RCause]
,[SubDate]
,[SubTime]
,[UID]
,[UName]
,[WeekNo]
,[WeekID]
,[LogDuration]
,[ContactNum]
FROM [CSCallLogger].[dbo].[tbl_Logs]
where [SubmittedDate] between @startdate and @enddate