0
I need to execute an SQL that brings me a result of only one cell, but, I need to capture information of two.
I will enter with start date and end date, my result will be a calculated value in that term.
I’ve tried several ways that I’ve found, but I don’t know if I didn’t know how to apply or didn’t work out for my case.
The query SQL:
select sum(cr.vl_receber)
from contareceber cr
where cr.dt_vencimento >= '20/12/2019'
and cr.dt_vencimento <= '26/12/2019'
and cr.cd_empresa = 1
and cr.cd_filial in (1,5)
and cr.cd_pessoa not in (4, 5, 8)
and cr.cd_formapgto = 3
and cr.tp_status in ('AB','IP','CA','PR','CO','IN')
The dates I need to read from a Spreadsheet cell and then the user will just update the dates in that cell, so they don’t need to update in the script.
That is, the user update the date in the excel table and the script already catch the date, load and display the expected result.
I imagine something used through Powerquery would help, but I tried codes like:
cr.dt_vencimento >= '"=Planilha1!B8"'
cr.dt_vencimento <= '"=Planilha1!C8"'
or:
cr.dt_vencimento >= '"B8"'
cr.dt_vencimento <= '"C8"'
or:
cr.dt_vencimento >= '"& B8 &"'
cr.dt_vencimento <= '"& C8 &"'
Anyway, I couldn’t or I couldn’t use it. How can I query this cell and click on the script so that the query is simpler for the user?