I am trying to figure out how to query to get the Sum result set daily.
Basically there are three fields on below query:
Declare @StartDate datetime
Declare @EndDate datetime
Set @StartDate = '06/13/2016'
Set @EndDate = '06/13/2016'
SELECT Column1, Column2, Column3, Date
WHERE Date between @StartDate and @EndDate
So, the Column1 has more than 1500 distinct values and Column1 returns different values daily. Some of the examples of the values of Column1 like:
ABC, FGH, GTY, LKO. etc.
How do I SUM the value based on the report value (ex: ABC, FGH, GTY, etc)? Since the value is not the INT but varchar.
Report runs daily so the values of Column1 is different daily. Today the value could be ABC, FGH, GTY, LKO, etc. Tomorrow
could be NNM,KMM,VBF, ETC and so on.
If the report has ABC value for example, I want to Sum of how many of that ABC value. The same thing if the report
has the value of FGH, I want to SUM of how many the FGH values are on the report on that day and so on and at the end, I only need to list the the top 5 highest of SUM from Column1.
How do I develop this logic based on above query?