Individuare i dettagli dei metodi di pagamento usati per enti con più località

PHOTO EMBED

Tue Jan 10 2023 14:22:22 GMT+0000 (Coordinated Universal Time)

Saved by @andrea_buniotto

use CallWebVT

SELECT SUBSTRING(Richieste.DescrizioneIncidente, 56, charindex(' ', SUBSTRING(Richieste.DescrizioneIncidente, 56, 100), 2)) AS localita
       ,Fatture.Numero as 'Numero Fattura', fatture.DataEmissione, Fatture.DataPagamento,
              case fatture.idMetodoPagamento 
              when 10 then 'PAGOPA'
              when 5 then 'SPORTELLO'
              else 'N/A'
       end as 'Metodo Pagamento',
       fatture.Totale,
       Richieste.GUID,
       concat(concat(richieste.PRONumero, '/'),Richieste.PROAnno) as protocollo ,
       RagSocCliente,CAPCliente,LocalitaCliente,ProvinciaCliente
FROM Fatture
INNER JOIN RigheFattura ON Fatture.ID = RigheFattura.IDFattura
INNER JOIN Richieste ON RigheFattura.IDRichiesta = Richieste.ID
WHERE Fatture.IDAderente = 160 /* <-- Indicare l'ID dell'Aderente */
       AND YEAR(Fatture.DataPagamento) = 2023
order by fatture.ID, localita


content_copyCOPY