0
votes

I have an Excel worksheet with several queries, where I enter a date format several times per query. When I produce the data for May I input '2021-05-31' several times, and when I want to produce data for June the date input must be changed for all of them.

Here's an example, where I extract customer transactions with transaction date up until 31.05.2021, that is not posted in a table with settled transactions up until 31.05.2021. Here I must change the date input twice:

SELECT * 
FROM CustTrans 
WHERE TransDate =< '2021-05-31' 
  AND VOUCHER NOT IN (SELECT VOUCHER 
                      FROM CustSettlement 
                      WHERE TransDate =< '2021-05-31') 

Is it possible to define a reference like 'Date' = '2021-05-31' and then repeat Transdate =< 'Date'?

And is it possible to reference one column from the Excel workbook for several queries?

There are a few places in Excel where one can write/submit sql to a database. Where is it that you are maintaining/writing this sql?JNevill