where (request_date between (@StartDate) and (@EndDate))
Set the data type for StartDate and EndDate to Date.
See link, it explains all the steps.
I have a query that selects the total number days between two dates. It selects the MIN number of days, the MAX number of days, and the AVG number of days, which are grouped by a TYPE.
Here's my SQL:
select
request_type as "Type",
min(DATEDIFF(DAY, request_date, request_last_update)) as "Min Days",
max(DATEDIFF(DAY, request_date, request_last_update)) as "Max Days",
avg(DATEDIFF(DAY, request_date, request_last_update)) as "Average Days"
from
zap.dbo.new_request
group by
request_type
I need to have a date picker that can pass the values into this query so that I can show results depending on what date range is selected.
If that's NOT what I should do, then can someone please tell me how I can add a date range to this query?
Thanks!