I'm new here, and i have a situation. I need to alter one report that i created a few time ago, that shows the planning of maintenance. But not all months/weeks have plan defined, and i want to show all months/weeks even in that situation. The table where i go get the data, have a column Month and onother named Week, and the matrix column group is on Month, and the second group is on Week.
I show you a image of what i have done, and the result.
And here is the query:
SELECT [dbo].[Equip_PIMP].[ID_Equip_PIMP] ,[dbo].[Contrato].[ID_Contrato] AS [Contrato_Nr] ,[dbo].[Cliente].[Nome] AS [NomeCliente] ,[dbo].[Instituicao].[Nome] AS [NomeInstituicao] ,[dbo].[Servico].[Nome] AS [NomeServico] ,[dbo].[Equip_Marca].[Nome] AS [NomeMarca] ,[dbo].[Modelos].[Nome] AS [NomeModelo] ,CASE WHEN @DIA_OU_X = 1 THEN CAST([dbo].[Equip_PIMP].[Dia] AS VARCHAR(2)) WHEN @DIA_OU_X = 0 THEN 'X' END AS [VALOR_CEL] ,[dbo].[Equip_PIMP].[Data_Plano] ,[dbo].[Equip_PIMP].[Data_Execucao] ,[dbo].[Rotina].[Nome] AS [NomeRotina] ,[dbo].[Rotina].[Tipo] AS [TipoRotina] ,[dbo].[Equip_Categoria].[Nome] AS [NomeCategoria] ,CASE [dbo].[Equip_PIMP].[Mes] WHEN 1 THEN 'JANEIRO' WHEN 2 THEN 'FEVEREIRO' WHEN 3 THEN 'MARÇO' WHEN 4 THEN 'ABRIL' WHEN 5 THEN 'MAIO' WHEN 6 THEN 'JUNHO' WHEN 7 THEN 'JULHO' WHEN 8 THEN 'AGOSTO' WHEN 9 THEN 'SETEMBRO' WHEN 10 THEN 'OUTUBRO' WHEN 11 THEN 'NOVEMBRO' WHEN 12 THEN 'DEZEMBRO' END AS [Mes_Nome] -- This is the MONTHNAME ,[dbo].[Equipamento].[ID_Equipamento] ,[dbo].[Equipamento].[Nome] ,[dbo].[Equipamento].[Marca] ,[dbo].[Equipamento].[Modelo] ,[dbo].[Equipamento].[Categoria] ,[dbo].[Equipamento].[Num_Serie] ,[dbo].[Equipamento].[Num_Inventario] ,[dbo].[Equipamento].[Num_Equipamento] ,[dbo].[Equip_PIMP].[Dia] ,[dbo].[Equip_PIMP].[Semana] -- This is the WEEKNUMBER ,[dbo].[Equip_PIMP].[Mes] -- This is the MONTHNUMBER ,[dbo].[Equip_PIMP].[Trimestre] ,[dbo].[Equip_PIMP].[Semestre] ,[dbo].[Equip_PIMP].[Ano] FROM ...