I currently have the following:
SELECT status,count(status) AS count
FROM [DB].[dbo].[contact]
GROUP BY status
Which gives me the following:
Status 1 | 12
Status 2 | 23
Status 3 | 63
I’m trying to get the table to look like this:
Status 1 Status 2 Status 3
12 23 63
Eventually the table will look like this:
Status 1 Status 2 Status 3
Date Range 1 12 23 63
Date Range 2 23 2 3
I’m just not sure what to do now. What kind of SQL commands / syntax should I study to get this done? This is my first time looking at SQL so any pointers would be awesome.
You can use a query like this which will get you the data in the correct format:
In SQL Server you can even use the
PIVOTfunction to transform the data: