Date range manipulation

I want to search the number of success responses for all the requests on a particular date range, I might get success response on next day as well. I am trying date_part<= ‘{{Date-range.end}}’ + interval 1 day
but that query is not working.
How can we add 1 day in {{Date-range.end}} parameter ??

SELECT count(*),
       date_part
FROM wc
WHERE date_part>='{{Date-range.start}}'
  AND date_part<= '{{Date-range.end}}' + interval 1 day
  AND response = 'SUCCESS'
  AND  flowStep ='RESPONSE'
  AND requestNo IN
    (SELECT DISTINCT requestNo
     FROM wc
     WHERE date_part>='{{Date-range.start}}'
       and date_part<='{{Date-range.end}}' 
      and  flowStep ='REQUEST'
)
GROUP BY date_part

For future searchers: this only applies to postgres.

There are two problems.

  1. interval requires its first argument to be in quotes: interval '1 day'
  2. You must cast the parameter to a date type first: CAST('{{ param }}' as date)
...
WHERE date_part >= '{{ Date-range.start }}'
  AND date_part <= CAST('{{ Date-range.start }}' as date) + interval '1 day'
1 Like