I'm trying to alter the results of a Transact-SQL (MS SQL Server) report that is currently showing:
CompanyA DVCE3
CompanyB DVCE2
CompanyC DVCE3
CompanyD NULL
CompanyE DVCE3
and I would like it instead to show:
CompanyA 36
CompanyB 24
CompanyC 36
CompanyD
CompanyE 36
I'm sure the answer to this is to use some kind of if/else statement or a case statement, but I'm not sure of the syntax of this in T-SQL or where it should go in my query.
My basic query looks like this:
SELECT
companyName
, term
FROM tableA a
JOIN tableB b on a.id = b.id ...
WHERE
customerNumber IS NOT NULL
AND companyName != 'TEST'... ;
Thanks for your help.