0

How do I find in my table new values added in a column by date?

I have a table, where I have a column with the contract numbers of my clients, but I want to make a comparison, if on my previous date I had X contracts and on my current date I had an extra contract number, it would describe these new contracts as " NEW CONTRACT", and if a contract from the previous day has disappeared in the column of contracts of the current day then "CONTRACTION ENDED".

How could I do that?

PICTURE OF MY TABLE: https://i.stack.imgur.com/UQafy.png

OBS: name of my table: "ECCR28", columns that I want to use "CC" which is my column with the contracts, and "DATE" for the contracting date

TABLE CSV: `"","AGENCIA","REFERENCIA","CD_PRODUTO","CC","NM_CLIENTE","OPERACAO","VL_LIMITE","VL_UTILIZADO","PC_TAXA","DT_CONTRATO","TP_CONTRATACAO","DT_VENCIMENTO","INDICADOR_SEGURO","DT_VENC_SEG","ST_CONTRATO"
"1","0011",2022-12-07,"0026","011002845-7","WARLEN TANIOS NEMER","01100284570026008","4.000,00","0,00","  100,00",2015-09-29,"PA",2023-09-08,"S",2023-09-29,"ATIV"
"2","0011",2022-12-07,"0026","011003535-6","EDUARDO RIBEIRO DOS SA","01100353560026001","1.400,00","0,00","  100,00",2022-05-03,"AS",2023-05-03,"N",NA,"ATIV"
"3","0011",2022-12-07,"0026","011003803-7","LAZARO GOMES DE MOURA","01100380370026002","2.600,00","0,00","  100,00",2022-05-03,"AS",2023-05-03,"N",NA,"ATIV""49","0011",2022-12-08,"0026","011002845-7","WARLEN TANIOS NEMER","01100284570026008","4.000,00","0,00","  100,00",2015-09-29,"PA",2023-09-08,"S",2023-09-29,"ATIV"
"50","0011",2022-12-08,"0026","011003535-6","EDUARDO RIBEIRO DOS SA","01100353560026001","1.400,00","0,00","  100,00",2022-05-03,"AS",2023-05-03,"N",NA,"ATIV"
"51","0011",2022-12-08,"0026","011003803-7","LAZARO GOMES DE MOURA","01100380370026002","2.600,00","0,00","  100,00",2022-05-03,"AS",2023-05-03,"N",NA,"ATIV"
"52","0011",2022-12-08,"0026","011003988-2","RODRIGO MENNA BARRETO","01100398820026001","1.200,00","1629,75","  100,00",2020-12-15,"AA",2021-12-14,"N",NA,"VENC"`
Mokubai
  • 89,133
  • 25
  • 207
  • 233
Deforceh
  • 3
  • 2
  • It would be easier for others to help you if you posted your table schema as text, and sample data. It would be even better if used a dbfiddle. – Rohit Gupta Dec 16 '22 at 01:58
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Dec 16 '22 at 01:58
  • @RohitGupta it's a csv table with a lot of data to put here, unless you upload my table in a link so you can download it and try – Deforceh Dec 16 '22 at 02:20
  • The keyword was sample. just a few rows to illustrate what you are trying to achieve :-) – Rohit Gupta Dec 16 '22 at 02:23
  • @RohitGupta ready – Deforceh Dec 16 '22 at 02:39

0 Answers0